Files
opensem/app/Models/Shop/Price.php

33 lines
636 B
PHP

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