Introduce a new shipment packages system to allow handling shipments consisting of multiple individual packages. This includes a new ShipmentPackage model, a dedicated database table, and a repeater field in the Filament ShipmentResource for managing package details such as weight, dimensions, and declared value. Additionally, update the AWB PDF generation service and template to include a detailed breakdown of all associated packages when multiple items are present.
29 lines
713 B
PHP
29 lines
713 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class ShipmentPackage extends Model
|
|
{
|
|
protected $fillable = [
|
|
'shipment_id', 'package_no', 'weight', 'volumetric_weight',
|
|
'chargeable_weight', 'dimensions', 'declared_value', 'content_description',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'weight' => 'decimal:2',
|
|
'volumetric_weight' => 'decimal:2',
|
|
'chargeable_weight' => 'decimal:2',
|
|
'declared_value' => 'decimal:2',
|
|
];
|
|
}
|
|
|
|
public function shipment(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Shipment::class);
|
|
}
|
|
} |