Files
shipping-portal/app/Models/Container.php
T
2021-08-23 08:39:59 +08:00

31 lines
746 B
PHP

<?php
namespace App\Models;
use App\Classes\General\Interfaces\Transportable;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Relations\MorphMany;
class Container extends AbstractModel implements Transportable
{
use SoftDeletes;
protected $table = 'containers';
protected $fillable = ['status'];
public function packingLists(): belongsToMany
{
return $this->belongsToMany(PackingList::class, ContainerPackingList::class, 'container_id', 'packing_list_id');
}
/**
* @return MorphMany
*/
public function transports(): morphMany
{
return $this->morphMany(Transport::class, 'owner');
}
}