add methods to get icon on article natures
This commit is contained in:
@@ -8,11 +8,17 @@ use App\Traits\Model\HasComments;
|
||||
use App\Traits\Model\Imageable;
|
||||
use Fico7489\Laravel\EloquentJoin\Traits\EloquentJoin;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasManyThrough;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphToMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Kirschbaum\PowerJoins\PowerJoins;
|
||||
use Rinvex\Categories\Traits\Categorizable;
|
||||
use Rinvex\Tags\Traits\Taggable;
|
||||
use Spatie\MediaLibrary\HasMedia;
|
||||
use Staudenmeir\EloquentHasManyDeep\HasManyDeep;
|
||||
use Staudenmeir\EloquentHasManyDeep\HasRelationships;
|
||||
use \Venturecraft\Revisionable\RevisionableTrait;
|
||||
use Wildside\Userstamps\Userstamps;
|
||||
@@ -47,22 +53,22 @@ class Article extends Model implements HasMedia
|
||||
'homepage',
|
||||
];
|
||||
|
||||
public function article_nature()
|
||||
public function article_nature(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(ArticleNature::class);
|
||||
}
|
||||
|
||||
public function invoiceItems()
|
||||
public function invoiceItems(): HasMany
|
||||
{
|
||||
return $this->hasMany(InvoiceItem::class);
|
||||
}
|
||||
|
||||
public function offers()
|
||||
public function offers(): HasMany
|
||||
{
|
||||
return $this->hasMany(Offer::class);
|
||||
}
|
||||
|
||||
public function price_lists()
|
||||
public function price_lists(): HasManyDeep
|
||||
{
|
||||
return $this->hasManyDeep(
|
||||
PriceList::class,
|
||||
@@ -72,7 +78,7 @@ class Article extends Model implements HasMedia
|
||||
);
|
||||
}
|
||||
|
||||
public function prices()
|
||||
public function prices(): HasManyDeep
|
||||
{
|
||||
return $this->hasManyDeep(
|
||||
PriceListValue::class,
|
||||
@@ -82,22 +88,22 @@ class Article extends Model implements HasMedia
|
||||
);
|
||||
}
|
||||
|
||||
public function product()
|
||||
public function product(): MorphTo
|
||||
{
|
||||
return $this->morphTo();
|
||||
}
|
||||
|
||||
public function siblings()
|
||||
public function siblings(): HasMany
|
||||
{
|
||||
return $this->hasMany(Article::class, 'name', 'name');
|
||||
}
|
||||
|
||||
public function tags()
|
||||
public function tags(): MorphToMany
|
||||
{
|
||||
return $this->morphToMany(Tag::class, 'taggable');
|
||||
}
|
||||
|
||||
public function tariffs()
|
||||
public function tariffs(): HasManyThrough
|
||||
{
|
||||
return $this->hasManyThrough(Tariff::class, Offer::class, 'article_id', 'id', 'id', 'tariff_id');
|
||||
// return $this->belongsToMany(Tariff::class, Offer::$table, 'id', 'id', 'tariff_id', 'tariff_id');
|
||||
|
||||
Reference in New Issue
Block a user