mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-19 04:24:12 +00:00
60 lines
1.4 KiB
PHP
60 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Classes\General\Interfaces\Steppable;
|
|
use App\Classes\General\Interfaces\Transportable;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
|
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class PackingList extends AbstractModel implements Transportable, Steppable
|
|
{
|
|
use SoftDeletes;
|
|
|
|
protected $table = 'packing_lists';
|
|
|
|
protected $fillable = ['status'];
|
|
|
|
/**
|
|
* @return \Illuminate\Database\Eloquent\Relations\MorphTo
|
|
*/
|
|
public function owner(): morphTo
|
|
{
|
|
return $this->morphTo();
|
|
}
|
|
|
|
public function containers(): BelongsToMany
|
|
{
|
|
return $this->BelongsToMany(Container::class, ContainerPackingList::class);
|
|
}
|
|
|
|
/**
|
|
* @return MorphMany
|
|
*/
|
|
public function steps(): morphMany
|
|
{
|
|
return $this->morphMany(Step::class, 'owner');
|
|
}
|
|
|
|
/**
|
|
* @return HasMany
|
|
*/
|
|
public function packages(): hasMany
|
|
{
|
|
return $this->hasMany(Package::class, 'packing_list_id');
|
|
}
|
|
|
|
/**
|
|
* @return morphMany
|
|
*/
|
|
public function transports(): morphMany
|
|
{
|
|
return $this->morphMany(Transport::class, 'owner');
|
|
}
|
|
|
|
}
|