Feat: Adding Shippment Tracking
This commit is contained in:
@@ -5,6 +5,7 @@ namespace Modules\Core\Shipping\Models;
|
||||
use Illuminate\Database\Eloquent\Casts\AsArrayObject;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Lunar\Models\Order;
|
||||
|
||||
class Shipment extends Model
|
||||
@@ -21,4 +22,14 @@ class Shipment extends Model
|
||||
{
|
||||
return $this->belongsTo(Order::class);
|
||||
}
|
||||
|
||||
public function shipmentInfo(): HasMany
|
||||
{
|
||||
return $this->hasMany(ShipmentInfo::class);
|
||||
}
|
||||
|
||||
public function latestShipmentInfo(): ?ShipmentInfo
|
||||
{
|
||||
return $this->shipmentInfo()->latest('occurred_at')->first();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user