mirror of
https://github.com/Cybrarist/Discount-Bandit.git
synced 2026-11-24 19:49:54 +01:00
- minimize data sent by plugin - fix the lowest price always zero. - add method to update the price when you visit the product page with the extension. - fix new store not added on existing product - format prices on chart - fix multiple prices not showing in tooltip in price history widget when store is added later on.
35 lines
592 B
PHP
35 lines
592 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Casts\Money;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class PriceHistory extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
|
|
protected $fillable=[
|
|
"date",
|
|
"price",
|
|
"product_id",
|
|
"store_id",
|
|
"used_price",
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
"price"=>Money::class,
|
|
"used_price"=>Money::class
|
|
];
|
|
}
|
|
|
|
public function product_store()
|
|
{
|
|
return $this->belongsTo(ProductStore::class);
|
|
}
|
|
}
|