Files
BarangaySystem/app/Models/Market/Shipment.php
2026-06-06 18:43:00 +08:00

70 lines
1.4 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Models\Market;
use App\Models\Model;
use App\Models\User;
use App\Models\GlobalTransaction;
class Shipment extends Model
{
protected ?string $table = 'shipments';
protected array $fillable = [
'hashkey',
'transaction_id',
'store_id',
'customer_id',
'courier_id',
'tracking_number',
'status',
'origin_address',
'destination_address',
'estimated_delivery_date',
'actual_delivery_date',
'shipping_fee',
'is_active',
'created_by',
'updated_by',
];
protected array $casts = [
'estimated_delivery_date' => 'datetime',
'actual_delivery_date' => 'datetime',
'shipping_fee' => 'decimal:2',
'is_active' => 'boolean',
];
public function transaction()
{
return $this->belongsTo(GlobalTransaction::class, 'transaction_id');
}
public function store()
{
return $this->belongsTo(Store::class, 'store_id');
}
public function customer()
{
return $this->belongsTo(Customer::class, 'customer_id');
}
public function courier()
{
return $this->belongsTo(Courier::class, 'courier_id');
}
public function creator()
{
return $this->belongsTo(User::class, 'created_by');
}
public function updater()
{
return $this->belongsTo(User::class, 'updated_by');
}
}