Merge branch 'master' into 'remark-create-api'

# Conflicts:
#   app/Models/Container.php
#   app/Models/PackingList.php
#   routes/order.php
#   routes/packing_list.php
This commit is contained in:
omair saleh
2021-11-26 07:23:35 +00:00
139 changed files with 4292 additions and 579 deletions
+12 -11
View File
@@ -2,14 +2,15 @@
namespace App\Models;
use App\Classes\General\Interfaces\Remarkable;
use App\Classes\General\Interfaces\Transportable;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\HasManyThrough;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Relations\MorphMany;
use Staudenmeir\EloquentHasManyDeep\HasManyDeep;
use Staudenmeir\EloquentHasManyDeep\HasRelationships;
class Container extends AbstractModel implements Transportable
class Container extends AbstractModel implements Transportable, Remarkable
{
use HasRelationships;
use SoftDeletes;
@@ -26,27 +27,27 @@ class Container extends AbstractModel implements Transportable
}
/**
* @return HasManyThrough
* @return hasManyDeep
*/
public function packages(): hasManyThrough
public function packages(): hasManyDeep
{
return $this->hasManyDeep(Package::class, [ContainerPackingList::class, PackingList::class], ['container_id', 'id', 'packing_list_id'], ['id', 'packing_list_id', 'id']);
return $this->hasManyDeepFromRelations($this->packingLists(), (new PackingList())->packages());
}
/**
* @return HasManyThrough
* @return hasManyDeep
*/
public function companyModules(): hasManyThrough
public function companyModules(): hasManyDeep
{
return $this->hasManyDeep(CompanyModule::class, [ContainerPackingList::class, PackingList::class, Order::class], ['container_id', 'id', 'id', 'id'], ['id', 'packing_list_id', null, 'company_module_id']);
return $this->hasManyDeep(CompanyModule::class, [ContainerPackingList::class, PackingList::class, Order::class], ['container_id', 'id', 'id', 'id'], ['id', 'packing_list_id', 'owner_id', 'company_module_id']);
}
/**
* @return HasManyThrough
* @return hasManyDeep
*/
public function orders(): hasManyThrough
public function orders(): hasManyDeep
{
return $this->hasManyDeep(Order::class, [ContainerPackingList::class, PackingList::class], ['container_id', 'id', 'id'], ['id', 'packing_list_id', null]);
return $this->hasManyDeep(Order::class, [ContainerPackingList::class, PackingList::class], ['container_id', 'id', 'id'], ['id', 'packing_list_id', 'owner_id']);
}
/**