51 lines
963 B
PHP
51 lines
963 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Timeslot extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
/**
|
|
* The attributes that are mass assignable.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $fillable = [
|
|
'order_id', 'shop_id', 'slot'
|
|
];
|
|
|
|
/**
|
|
* The attributes that should be cast to native types.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $casts = [
|
|
'slot' => 'datetime'
|
|
];
|
|
|
|
// * RELATIONSHIPS
|
|
|
|
/**
|
|
* BelongsTo order relation
|
|
*
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
*/
|
|
public function order()
|
|
{
|
|
return $this->belongsTo(Order::class, 'order_uuid', 'uuid');
|
|
}
|
|
|
|
/**
|
|
* BelongsTo shop relation
|
|
*
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
*/
|
|
public function shop()
|
|
{
|
|
return $this->belongsTo(Shop::class);
|
|
}
|
|
}
|