refactor: align codebase with EventCrew domain and trim legacy band stack
- Update API: events, users, policies, routes, resources, migrations - Remove deprecated models/resources (customers, setlists, invitations, etc.) - Refresh admin app and docs; remove apps/band Made-with: Cursor
This commit is contained in:
@@ -6,28 +6,29 @@ namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Concerns\HasUlids;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Laravel\Sanctum\HasApiTokens;
|
||||
use Spatie\Permission\Traits\HasRoles;
|
||||
|
||||
final class User extends Authenticatable
|
||||
{
|
||||
use HasApiTokens;
|
||||
use HasFactory;
|
||||
use HasRoles;
|
||||
use HasUlids;
|
||||
use Notifiable;
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'email',
|
||||
'phone',
|
||||
'bio',
|
||||
'instruments',
|
||||
'avatar_path',
|
||||
'type',
|
||||
'role',
|
||||
'status',
|
||||
'password',
|
||||
'timezone',
|
||||
'locale',
|
||||
'avatar',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
@@ -40,39 +41,20 @@ final class User extends Authenticatable
|
||||
return [
|
||||
'email_verified_at' => 'datetime',
|
||||
'password' => 'hashed',
|
||||
'instruments' => 'array',
|
||||
];
|
||||
}
|
||||
|
||||
// Helper methods
|
||||
|
||||
public function isAdmin(): bool
|
||||
public function organisations(): BelongsToMany
|
||||
{
|
||||
return $this->role === 'admin';
|
||||
return $this->belongsToMany(Organisation::class, 'organisation_user')
|
||||
->withPivot('role')
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
public function isBookingAgent(): bool
|
||||
public function events(): BelongsToMany
|
||||
{
|
||||
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';
|
||||
return $this->belongsToMany(Event::class, 'event_user_roles')
|
||||
->withPivot('role')
|
||||
->withTimestamps();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user