hasMany(Mod::class); } public function toSearchableArray(): array { return [ 'id' => (int) $this->id, 'name' => $this->name, ]; } public function shouldBeSearchable(): bool { return ! is_null($this->email_verified_at); } public function assignRole(UserRole $role): bool { $this->role()->associate($role); return $this->save(); } public function role(): BelongsTo { return $this->belongsTo(UserRole::class, 'user_role_id'); } public function isAdmin(): bool { return Str::lower($this->role->name) === 'administrator'; } protected function casts(): array { return [ 'email_verified_at' => 'datetime', 'password' => 'hashed', ]; } /** * Get the disk that profile photos should be stored on. */ protected function profilePhotoDisk(): string { return match (config('app.env')) { 'production' => 'r2', // Cloudflare R2 Storage default => 'public', // Local }; } }