mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-19 12:34:18 +00:00
634d4b8b7d
# Conflicts: # app/Models/Container.php # app/Models/PackingList.php # routes/order.php # routes/packing_list.php
75 lines
1.7 KiB
PHP
75 lines
1.7 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');
|
|
}
|
|
|
|
/**
|
|
* @return MorphMany
|
|
*/
|
|
public function remarks(): morphMany
|
|
{
|
|
return $this->morphMany(Remark::class, 'owner');
|
|
}
|
|
|
|
/**
|
|
* @return belongsToMany
|
|
*/
|
|
public function packing_list_owner()
|
|
{
|
|
return $this->BelongsToMany(PackingList::class, 'packing_list_owner', 'owner_packing_list_id', 'packing_list_id');
|
|
}
|
|
}
|