52 lines
1.2 KiB
PHP
52 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Models\Shop;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Spatie\MediaLibrary\HasMedia\HasMedia;
|
|
use Spatie\MediaLibrary\HasMedia\HasMediaTrait;
|
|
use Rinvex\Categories\Traits\Categorizable;
|
|
use Rinvex\Tags\Traits\Taggable;
|
|
use Fico7489\Laravel\EloquentJoin\Traits\EloquentJoin;
|
|
|
|
class Article extends Model implements HasMedia
|
|
{
|
|
use Categorizable;
|
|
use Taggable;
|
|
use HasMediaTrait;
|
|
use EloquentJoin;
|
|
|
|
protected $guarded = ['id'];
|
|
protected $table = 'shop_articles';
|
|
|
|
public function Family()
|
|
{
|
|
return $this->belongsTo('App\Models\Shop\ArticleFamily','article_family_id');
|
|
}
|
|
|
|
public function Inventories()
|
|
{
|
|
return $this->hasMany('App\Models\Shop\Inventory');
|
|
}
|
|
|
|
public function Prices()
|
|
{
|
|
return $this->hasMany('App\Models\Shop\ArticlePrice');
|
|
}
|
|
|
|
public function Attributes()
|
|
{
|
|
return $this->hasManyThrough('App\Models\Shop\ArticleAttribute','App\Models\Shop\ArticlePrice');
|
|
}
|
|
|
|
public function InvoiceItems()
|
|
{
|
|
return $this->hasMany('App\Models\Shop\InvoiceItem');
|
|
}
|
|
|
|
public function Product()
|
|
{
|
|
return $this->belongsTo($this->model, 'model_id');
|
|
}
|
|
|
|
} |