message
This commit is contained in:
@@ -4,19 +4,37 @@ namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Models\MarkList;
|
||||
|
||||
class Order extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'order_id', 'mark_no', 'description', 'origin', 'destination',
|
||||
'ctn', 'qty', 'ttl_qty', 'unit', 'price', 'ttl_amount',
|
||||
'cbm', 'ttl_cbm', 'kg', 'ttl_kg', 'shop_no', 'status'
|
||||
'order_id',
|
||||
'mark_no',
|
||||
'origin',
|
||||
'destination',
|
||||
|
||||
// totals only
|
||||
'ctn',
|
||||
'qty',
|
||||
'ttl_qty',
|
||||
'ttl_amount',
|
||||
'cbm',
|
||||
'ttl_cbm',
|
||||
'kg',
|
||||
'ttl_kg',
|
||||
|
||||
'status'
|
||||
];
|
||||
|
||||
// Relation using mark_no instead of id
|
||||
// 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');
|
||||
|
||||
Reference in New Issue
Block a user