Add display articles & categories, raw mode

This commit is contained in:
Ludovic CANDELLIER
2020-08-20 23:55:42 +02:00
parent 12aff23e00
commit 77a239fce9
15 changed files with 102 additions and 88 deletions

View File

@@ -26,9 +26,14 @@ class Article extends Model implements HasMedia
return $this->hasMany('App\Models\Shop\ArticleAttribute');
}
public function prices()
public function images()
{
return $this->hasManyThrough('App\Models\Shop\ArticlePrice','App\Models\Shop\ArticleAttribute');
return $this->hasMany('App\Models\Core\Media','model_id')->where('model_type','App\Models\Shop\Article');
}
public function image()
{
return $this->hasOne('App\Models\Core\Media','model_id')->where('model_type','App\Models\Shop\Article');
}
public function inventories()
@@ -41,6 +46,11 @@ class Article extends Model implements HasMedia
return $this->hasMany('App\Models\Shop\InvoiceItem');
}
public function prices()
{
return $this->hasManyThrough('App\Models\Shop\ArticlePrice','App\Models\Shop\ArticleAttribute');
}
public function product()
{
return $this->morphTo();