-
app/Casts/LatitudeLongitudeCast.php
Open in GitHubuse Illuminate\Contracts\Database\Eloquent\CastsAttributes; class LatitudeLongitudeCast implements CastsAttributes { public function get($model, string $key, $value, array $attributes) : string { return str_replace(',', ', ', $value); } public function set($model, string $key, $value, array $attributes) : mixed { return str_replace(' ', '', $value); } }
-
app/Models/User.php
Open in GitHubuse App\Types\Model; use App\Casts\LatitudeLongitudeCast; use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract; use Illuminate\Contracts\Auth\MustVerifyEmail as MustVerifyEmailContract; use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract; use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract; class User extends Model implements AuthenticatableContract, AuthorizableContract, CanResetPasswordContract, MustVerifyEmailContract { // protected $casts = [ // 'coordinates' => LatitudeLongitudeCast::class, // ]; // }