Skip to main content

Black Friday 2025! Only until December 1st: coupon FRIDAY25 for 40% off Yearly/Lifetime membership!

Read more here

caneara/lumeno

14 stars
2 code files
View caneara/lumeno on GitHub

app/Casts/LatitudeLongitudeCast.php

Open in GitHub
use 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 GitHub
use 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,
//
];
//
}

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.