fixes
This commit is contained in:
@@ -3,9 +3,14 @@
|
||||
namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
use Znck\Eloquent\Traits\BelongsToThrough;
|
||||
|
||||
class Unity extends Model
|
||||
{
|
||||
use BelongsToThrough, softDeletes;
|
||||
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_unities';
|
||||
|
||||
@@ -14,6 +19,11 @@ class Unity extends Model
|
||||
return $this->belongsTo('App\Models\Shop\Package');
|
||||
}
|
||||
|
||||
public function article_family()
|
||||
{
|
||||
return $this->belongsToThrough('App\Models\Shop\ArticleFamily', 'App\Models\Shop\Package', null, '', ['App\Models\Shop\ArticleFamily' => 'article_family_id', 'App\Models\Shop\Package' => 'package_id']);
|
||||
}
|
||||
|
||||
public function scopeByPackage($query, $id)
|
||||
{
|
||||
return $query->where('package_id', $id);
|
||||
|
||||
Reference in New Issue
Block a user