for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Siak\Tontine\Model;
use Illuminate\Database\Eloquent\Casts\Attribute;
class User extends \App\Models\User
{
use Traits\HasProperty;
Siak\Tontine\Model\Traits\HasProperty
Siak\Tontine\Model\User
$property
$content
/**
* Get the values of the properties.
*
* @return Attribute
*/
protected function city(): Attribute
return Attribute::make(
get: fn() => $this->profile ? $this->profile->city : '',
);
}
protected function countryCode(): Attribute
get: fn() => $this->profile ? $this->profile->country_code : '',
protected function locale(): Attribute
get: fn() => $this->properties['locale'] ?? 'fr',
properties
Checks if undeclared accessed properties appear in database migrations and if the creating migration is correct.
public function profile()
return $this->hasOne(Profile::class);
public function guilds()
return $this->hasMany(Guild::class)->orderBy('guilds.id', 'desc');
public function host_invites()
return $this->hasMany(GuestInvite::class, 'host_id');
public function guest_invites()
return $this->hasMany(GuestInvite::class, 'guest_id');