42 lines
855 B
PHP
42 lines
855 B
PHP
<?php
|
||
|
||
namespace App\Models;
|
||
|
||
use Illuminate\Database\Eloquent\Model;
|
||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||
|
||
class Booking extends Model
|
||
{
|
||
use HasFactory;
|
||
|
||
protected $fillable = [
|
||
'booking_number',
|
||
'client_id',
|
||
'employee_id',
|
||
'service_id',
|
||
'booking_date',
|
||
'start_time',
|
||
'end_time',
|
||
'status',
|
||
'cancelled_by',
|
||
'cancel_reason'
|
||
];
|
||
|
||
// Связь с клиентом
|
||
public function client()
|
||
{
|
||
return $this->belongsTo(User::class, 'client_id');
|
||
}
|
||
|
||
// Связь со сотрудником
|
||
public function employee()
|
||
{
|
||
return $this->belongsTo(User::class, 'employee_id');
|
||
}
|
||
|
||
// Связь с услугой
|
||
public function service()
|
||
{
|
||
return $this->belongsTo(Service::class);
|
||
}
|
||
} |