79 lines
1.5 KiB
PHP
79 lines
1.5 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Concerns\HasUlids;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
|
use Illuminate\Notifications\Notifiable;
|
|
use Laravel\Sanctum\HasApiTokens;
|
|
|
|
final class User extends Authenticatable
|
|
{
|
|
use HasApiTokens;
|
|
use HasFactory;
|
|
use HasUlids;
|
|
use Notifiable;
|
|
|
|
protected $fillable = [
|
|
'name',
|
|
'email',
|
|
'phone',
|
|
'bio',
|
|
'instruments',
|
|
'avatar_path',
|
|
'type',
|
|
'role',
|
|
'status',
|
|
'password',
|
|
];
|
|
|
|
protected $hidden = [
|
|
'password',
|
|
'remember_token',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'email_verified_at' => 'datetime',
|
|
'password' => 'hashed',
|
|
'instruments' => 'array',
|
|
];
|
|
}
|
|
|
|
// Helper methods
|
|
|
|
public function isAdmin(): bool
|
|
{
|
|
return $this->role === 'admin';
|
|
}
|
|
|
|
public function isBookingAgent(): bool
|
|
{
|
|
return $this->role === 'booking_agent';
|
|
}
|
|
|
|
public function isMusicManager(): bool
|
|
{
|
|
return $this->role === 'music_manager';
|
|
}
|
|
|
|
public function isMember(): bool
|
|
{
|
|
return $this->type === 'member';
|
|
}
|
|
|
|
public function isCustomer(): bool
|
|
{
|
|
return $this->type === 'customer';
|
|
}
|
|
|
|
public function isActive(): bool
|
|
{
|
|
return $this->status === 'active';
|
|
}
|
|
}
|