35 lines
710 B
PHP
35 lines
710 B
PHP
<?php
|
|
|
|
namespace App\Models\Shop;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Staudenmeir\EloquentHasManyDeep\HasRelationships;
|
|
|
|
class Price extends Model
|
|
{
|
|
use HasRelationships;
|
|
|
|
protected $guarded = ['id'];
|
|
protected $table = 'shop_prices';
|
|
|
|
public function article()
|
|
{
|
|
return $this->belongsTo('App\Models\Shop\Article');
|
|
}
|
|
|
|
public function article_family()
|
|
{
|
|
return $this->belongsTo('App\Models\Shop\ArticleNature');
|
|
}
|
|
|
|
public function scopeByArticle($query, $id)
|
|
{
|
|
return $query->where('article_id', $id);
|
|
}
|
|
|
|
public function scopeByArticleNature($query, $id)
|
|
{
|
|
return $query->where('article_family_id', $id);
|
|
}
|
|
}
|