Mise à jour
This commit is contained in:
@@ -7,39 +7,34 @@ use Znck\Eloquent\Traits\BelongsToThrough;
|
||||
|
||||
class PriceGeneric extends Model
|
||||
{
|
||||
use BelongsToThrough;
|
||||
use BelongsToThrough;
|
||||
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_price_generics';
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_price_generics';
|
||||
|
||||
public function category()
|
||||
{
|
||||
return $this->hasOne('App\Models\Shop\PriceGenericCategory','id','category_id');
|
||||
}
|
||||
public function category()
|
||||
{
|
||||
return $this->hasOne('App\Models\Shop\PriceGenericCategory','id','category_id');
|
||||
}
|
||||
|
||||
public function prices()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\Price','price_id')->where('price_type','App\Models\Shop\PriceGeneric');
|
||||
return $this->hasMany('App\Models\Shop\PriceGenericValue','price_generic_id')->whereNotNull('price_generic_id');
|
||||
}
|
||||
|
||||
public function values()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\PriceGenericValue');
|
||||
}
|
||||
public function priceByUnit()
|
||||
{
|
||||
return $this->hasOne('App\Models\Shop\PriceGenericValue')->orderBy('quantity','asc');
|
||||
}
|
||||
|
||||
public function priceByUnit()
|
||||
{
|
||||
return $this->hasOne('App\Models\Shop\PriceGenericValue')->orderBy('quantity','asc');
|
||||
}
|
||||
public function articles()
|
||||
{
|
||||
return $this->hasManyThrough('App\Models\Shop\Article','App\Models\Shop\Price');
|
||||
}
|
||||
|
||||
public function articles()
|
||||
{
|
||||
return $this->hasManyThrough('App\Models\Shop\Article','App\Models\Shop\Price');
|
||||
}
|
||||
|
||||
public function scopeByCategory($query, $id)
|
||||
{
|
||||
return $query->where('category_id', $id);
|
||||
}
|
||||
public function scopeByCategory($query, $id)
|
||||
{
|
||||
return $query->where('category_id', $id);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user