🔄 در حال انجام: تست دستی Filament ⏸️ بلاک: مهاجرت ۳۹۵۰ رکورد (منتظر فایل اکسل اصلاحشده) ⏸️ بلاک: پلاگین وردپرس (بعد از تست کامل API)
62 lines
1.9 KiB
PHP
62 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
class Shipment extends Model
|
|
{
|
|
protected $fillable = [
|
|
'user_id', 'awb_no', 'forwarder', 'direction', 'type', 'status', 'reason_for_export',
|
|
'weight', 'volumetric_weight', 'chargeable_weight', 'dimensions',
|
|
'shipping_price', 'extra_service', 'packing_cost', 'domestic_pickup', 'domestic_delivery',
|
|
'warehousing_cost', 'vat_amount', 'discount', 'total_fee', 'net_dirham', 'net_rial',
|
|
'from_country_id', 'to_country_id',
|
|
'sender_name', 'sender_company', 'sender_phone', 'sender_email',
|
|
'sender_address', 'sender_city', 'sender_zip', 'sender_id_number',
|
|
'receiver_name', 'receiver_company', 'receiver_phone', 'receiver_email',
|
|
'receiver_address', 'receiver_city', 'receiver_zip', 'receiver_id_number',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'direction' => \App\Enums\ShipmentDirection::class,
|
|
'type' => \App\Enums\ShipmentType::class,
|
|
'status' => \App\Enums\ShipmentStatus::class,
|
|
];
|
|
}
|
|
|
|
public function user(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
|
|
public function fromCountry(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Country::class, 'from_country_id');
|
|
}
|
|
|
|
public function toCountry(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Country::class, 'to_country_id');
|
|
}
|
|
|
|
public function items(): HasMany
|
|
{
|
|
return $this->hasMany(ShipmentItem::class);
|
|
}
|
|
|
|
public function carrierMappings(): HasMany
|
|
{
|
|
return $this->hasMany(ShipmentCarrierMapping::class);
|
|
}
|
|
|
|
public function trackingEvents(): HasMany
|
|
{
|
|
return $this->hasMany(ShipmentTrackingEvent::class);
|
|
}
|
|
}
|