Add new version in repository
This commit is contained in:
@@ -2,54 +2,33 @@
|
||||
|
||||
namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Staudenmeir\EloquentHasManyDeep\HasRelationships;
|
||||
|
||||
class Price extends Model
|
||||
{
|
||||
use HasRelationships;
|
||||
use HasRelationships;
|
||||
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_prices';
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_prices';
|
||||
|
||||
public function article()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\Article');
|
||||
}
|
||||
public function article()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\Article');
|
||||
}
|
||||
|
||||
public function article_family()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\ArticleFamily');
|
||||
}
|
||||
public function article_family()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\ArticleNature');
|
||||
}
|
||||
|
||||
public function generic()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\PriceGeneric', 'price_generic_id');
|
||||
}
|
||||
public function scopeByArticle($query, $id)
|
||||
{
|
||||
return $query->where('article_id', $id);
|
||||
}
|
||||
|
||||
public function generic_prices()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function scopeByArticle($query, $id)
|
||||
{
|
||||
return $query->where('article_id', $id);
|
||||
}
|
||||
|
||||
public function scopeByArticleFamily($query, $id)
|
||||
{
|
||||
return $query->where('article_family_id', $id);
|
||||
}
|
||||
|
||||
public function scopeGeneric($query)
|
||||
{
|
||||
return $query->whereNotNull('price_generic_id');
|
||||
}
|
||||
|
||||
public function scopeNotGeneric($query)
|
||||
{
|
||||
return $query->whereNull('price_generic_id');
|
||||
}
|
||||
|
||||
}
|
||||
public function scopeByArticleNature($query, $id)
|
||||
{
|
||||
return $query->where('article_family_id', $id);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user