DHL Modul v0.5 Shipping Label ok
This commit is contained in:
parent
480fdc65ed
commit
8fdaa0ba1d
122 changed files with 17938 additions and 2239 deletions
|
|
@ -101,6 +101,12 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||
* @property int|null $abo_interval
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrder whereAboInterval($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrder whereIsAbo($value)
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\DhlShipment> $dhlOutboundShipments
|
||||
* @property-read int|null $dhl_outbound_shipments_count
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\DhlShipment> $dhlReturnShipments
|
||||
* @property-read int|null $dhl_return_shipments_count
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\DhlShipment> $dhlShipments
|
||||
* @property-read int|null $dhl_shipments_count
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class ShoppingOrder extends Model
|
||||
|
|
@ -623,4 +629,44 @@ class ShoppingOrder extends Model
|
|||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get DHL shipments for this order
|
||||
*/
|
||||
public function dhlShipments()
|
||||
{
|
||||
return $this->hasMany('App\Models\DhlShipment', 'shopping_order_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get outbound DHL shipments only
|
||||
*/
|
||||
public function dhlOutboundShipments()
|
||||
{
|
||||
return $this->hasMany('App\Models\DhlShipment', 'shopping_order_id')->where('type', 'outbound');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get return DHL shipments only
|
||||
*/
|
||||
public function dhlReturnShipments()
|
||||
{
|
||||
return $this->hasMany('App\Models\DhlShipment', 'shopping_order_id')->where('type', 'return');
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if order has DHL shipments
|
||||
*/
|
||||
public function hasDhlShipments(): bool
|
||||
{
|
||||
return $this->dhlShipments()->exists();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get latest DHL shipment
|
||||
*/
|
||||
public function getLatestDhlShipment()
|
||||
{
|
||||
return $this->dhlShipments()->latest()->first();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue