53 lines
1.4 KiB
PHP
53 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
use Illuminate\Database\Eloquent\Relations\HasOne;
|
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
|
use Illuminate\Notifications\Notifiable;
|
|
use Laravel\Cashier\Billable;
|
|
use Laravel\Sanctum\HasApiTokens;
|
|
use Spatie\Permission\Traits\HasRoles;
|
|
|
|
class User extends Authenticatable
|
|
{
|
|
use Billable, HasApiTokens, HasFactory, HasRoles, Notifiable;
|
|
|
|
protected $fillable = ['name', 'email', 'password', 'phone', 'avatar_path', 'marketing_opt_in'];
|
|
|
|
protected $hidden = ['password', 'remember_token'];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'email_verified_at' => 'datetime',
|
|
'password' => 'hashed',
|
|
'marketing_opt_in' => 'boolean',
|
|
'trial_ends_at' => 'datetime',
|
|
];
|
|
}
|
|
|
|
public function businesses(): BelongsToMany
|
|
{
|
|
return $this->belongsToMany(Business::class)->withPivot(['role'])->withTimestamps();
|
|
}
|
|
|
|
public function djProfile(): HasOne
|
|
{
|
|
return $this->hasOne(DjProfile::class);
|
|
}
|
|
|
|
public function enquiries(): HasMany
|
|
{
|
|
return $this->hasMany(Enquiry::class);
|
|
}
|
|
|
|
public function bookings(): HasMany
|
|
{
|
|
return $this->hasMany(Booking::class, 'client_id');
|
|
}
|
|
}
|