ownedTeams() * @method static UserFactory factory() */ class User extends Authenticatable { use HasApiTokens; use HasFactory; use HasProfilePhoto; use HasTeams; use HasUuids; use Notifiable; use TwoFactorAuthenticatable; /** * The attributes that are mass assignable. * * @var array */ protected $fillable = [ 'name', 'email', 'password', ]; /** * The attributes that should be hidden for serialization. * * @var array */ protected $hidden = [ 'password', 'remember_token', 'two_factor_recovery_codes', 'two_factor_secret', ]; /** * The attributes that should be cast. * * @var array */ protected $casts = [ 'name' => 'string', 'email' => 'string', 'email_verified_at' => 'datetime', 'is_admin' => 'boolean', 'is_placeholder' => 'boolean', ]; /** * The accessors to append to the model's array form. * * @var array */ protected $appends = [ 'profile_photo_url', ]; public function canAccessPanel(Panel $panel): bool { return in_array($this->email, config('auth.super_admins', []), true); } /** * @return BelongsToMany */ public function organizations(): BelongsToMany { return $this->belongsToMany(Organization::class, Membership::class) ->withPivot([ 'role', ]) ->withTimestamps() ->as('membership'); } }