2025-08-05 14:47:02 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
2025-11-12 16:35:16 +01:00
|
|
|
use App\Models\Coupon;
|
2025-08-05 14:47:02 +02:00
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
|
use Illuminate\Database\Eloquent\Relations\HasOne;
|
|
|
|
|
|
|
|
|
|
class BasketContent extends Model
|
|
|
|
|
{
|
|
|
|
|
use HasFactory;
|
|
|
|
|
|
2025-08-14 17:05:09 +02:00
|
|
|
/**
|
|
|
|
|
* booted method
|
|
|
|
|
*
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
|
|
|
|
protected static function booted()
|
|
|
|
|
{
|
|
|
|
|
static::creating(function (self $model) {
|
|
|
|
|
$model->printed = 0;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2025-08-05 14:47:02 +02:00
|
|
|
/**
|
|
|
|
|
* Basket model relation
|
|
|
|
|
* @return HasOne
|
|
|
|
|
*/
|
|
|
|
|
public function basket()
|
|
|
|
|
{
|
|
|
|
|
return $this->hasOne(Basket::class);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Coupon model relation
|
|
|
|
|
* @return HasOne
|
|
|
|
|
*/
|
|
|
|
|
public function coupon()
|
|
|
|
|
{
|
|
|
|
|
return $this->hasOne(Coupon::class, 'coupon_id', 'coupon_id');
|
|
|
|
|
}
|
|
|
|
|
}
|