mirror of
https://github.com/Cybrarist/Discount-Bandit.git
synced 2026-11-24 19:49:54 +01:00
products still being pulled if price was not pulled instead of sending them to the end of the queue Took 25 minutes
63 lines
1.4 KiB
PHP
63 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Casts\Money;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\Pivot;
|
|
|
|
class ProductStore extends Pivot
|
|
{
|
|
|
|
protected $fillable = [
|
|
"updated_at",
|
|
"product_id",
|
|
"store_id",
|
|
"price",
|
|
"used_price",
|
|
"notify_price",
|
|
"notify_percentage",
|
|
"rate",
|
|
"number_of_rates",
|
|
"seller",
|
|
"offers",
|
|
"shipping_price",
|
|
"condition",
|
|
"notifications_sent",
|
|
"lowest_30",
|
|
"add_shipping",
|
|
"in_stock",
|
|
"key",
|
|
"highest_price",
|
|
"lowest_price",
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'price' => Money::class,
|
|
'highest_price' => Money::class,
|
|
'lowest_price' => Money::class,
|
|
'used_price' => Money::class,
|
|
'notify_price' => Money::class,
|
|
'notify_percentage' => Money::class,
|
|
'shipping_price' => Money::class,
|
|
];
|
|
}
|
|
|
|
public function product(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Product::class);
|
|
}
|
|
|
|
public function store(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Store::class);
|
|
}
|
|
|
|
public function stores_available(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Store::class, 'store_id')->whereHas('products');
|
|
}
|
|
}
|