| 1 |
<?php |
| 2 |
|
| 3 |
namespace FluentBooking\App\Models; |
| 4 |
class Staff extends Meta |
| 5 |
{ |
| 6 |
public static function boot() |
| 7 |
{ |
| 8 |
parent::boot(); |
| 9 |
|
| 10 |
static::addGlobalScope('staff', function ($builder) { |
| 11 |
$builder->where('object_type', 'staff'); |
| 12 |
}); |
| 13 |
|
| 14 |
static::creating(function ($model) { |
| 15 |
$model->object_type = 'staff'; |
| 16 |
}); |
| 17 |
} |
| 18 |
|
| 19 |
public function user() |
| 20 |
{ |
| 21 |
return $this->belongsTo(User::class, 'object_id'); |
| 22 |
} |
| 23 |
|
| 24 |
} |
| 25 |
|