Add new data in getBasket context
This commit is contained in:
@@ -6,10 +6,11 @@ use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
use Znck\Eloquent\Traits\BelongsToThrough;
|
||||
use App\Traits\Model\HasComments;
|
||||
use Staudenmeir\EloquentHasManyDeep\HasRelationships;
|
||||
|
||||
class Offer extends Model
|
||||
{
|
||||
use BelongsToThrough, HasComments;
|
||||
use BelongsToThrough, HasComments, HasRelationships;
|
||||
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_offers';
|
||||
@@ -27,6 +28,26 @@ class Offer extends Model
|
||||
]);
|
||||
}
|
||||
|
||||
public function categories()
|
||||
{
|
||||
return $this->article->categories();
|
||||
}
|
||||
|
||||
public function price_lists()
|
||||
{
|
||||
return $this->hasManyThrough(PriceList::class, Tariff::class, 'id', 'tariff_id', 'tariff_id', 'id');
|
||||
}
|
||||
|
||||
public function price_list_values()
|
||||
{
|
||||
return $this->hasManyDeep(
|
||||
PriceListValue::class,
|
||||
[Tariff::class, PriceList::class],
|
||||
['id', 'tariff_id', 'price_list_id'],
|
||||
['tariff_id', 'id', 'id'],
|
||||
);
|
||||
}
|
||||
|
||||
public function tariff()
|
||||
{
|
||||
return $this->belongsTo(Tariff::class);
|
||||
@@ -37,16 +58,6 @@ class Offer extends Model
|
||||
return $this->belongsTo(Variation::class);
|
||||
}
|
||||
|
||||
public function price_lists()
|
||||
{
|
||||
return $this->hasManyThrough(PriceList::class, Tariff::class, 'id', 'tariff_id', 'tariff_id', 'id');
|
||||
}
|
||||
|
||||
public function categories()
|
||||
{
|
||||
return $this->article->categories();
|
||||
}
|
||||
|
||||
public function tags()
|
||||
{
|
||||
return $this->article->tags();
|
||||
|
||||
Reference in New Issue
Block a user