43 lines
743 B
PHP
43 lines
743 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Order extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'order_id',
|
|
'mark_no',
|
|
'origin',
|
|
'destination',
|
|
|
|
// totals only
|
|
'ctn',
|
|
'qty',
|
|
'ttl_qty',
|
|
'ttl_amount',
|
|
'cbm',
|
|
'ttl_cbm',
|
|
'kg',
|
|
'ttl_kg',
|
|
|
|
'status'
|
|
];
|
|
|
|
// One order has many items
|
|
public function items()
|
|
{
|
|
return $this->hasMany(OrderItem::class);
|
|
}
|
|
|
|
// Link using mark_no (optional)
|
|
public function markList()
|
|
{
|
|
return $this->hasOne(MarkList::class, 'mark_no', 'mark_no');
|
|
}
|
|
}
|