[WIP] Refactor models to better lisibility and speed

This commit is contained in:
Ludovic CANDELLIER
2020-08-24 01:14:54 +02:00
parent 77a239fce9
commit 3b6108b449
22 changed files with 351 additions and 400 deletions

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Models\Shop;
use Illuminate\Database\Eloquent\Model;
use Staudenmeir\EloquentHasManyDeep\HasRelationships;
class PriceFamily extends Model
{
use HasRelationships;
protected $guarded = ['id'];
protected $table = 'shop_price_families';
public function prices()
{
return $this->hasMany('App\Models\Shop\Price');
}
public function values()
{
return $this->hasMany('App\Models\Shop\PriceFamilyValue');
}
public function articles()
{
return $this->hasManyThrough('App\Models\Shop\Article','App\Models\Shop\Price');
}
}