Files
opensem/app/Models/Shop/Basket.php
2024-02-22 19:35:51 +01:00

33 lines
616 B
PHP

<?php
namespace App\Models\Shop;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class Basket extends Model
{
protected $fillable = [
'id', 'cart_data',
];
protected $guarded = ['id'];
protected $table = 'shop_baskets';
public function Offer(): BelongsTo
{
return $this->belongsTo(Offer::class);
}
public function setCartDataAttribute($value)
{
$this->attributes['cart_data'] = serialize($value);
}
public function getCartDataAttribute($value)
{
return unserialize($value);
}
}