36 lines
730 B
PHP
36 lines
730 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Order extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
/**
|
|
* use carefully
|
|
*/
|
|
public function products() {
|
|
return $this->belongsToMany(Product::class, 'order_lines', 'order_id', 'product_id');
|
|
}
|
|
|
|
public function lines()
|
|
{
|
|
return $this->hasMany(OrderLine::class);
|
|
}
|
|
|
|
public function status() {
|
|
return $this->belongsTo('App\Models\OrdersStatus', 'status_id');
|
|
}
|
|
|
|
public function customer() {
|
|
return $this->belongsTo(Customers::class);
|
|
}
|
|
|
|
public function timeslot()
|
|
{
|
|
return $this->hasOne(Timeslot::class);
|
|
}
|
|
}
|