36 lines
591 B
PHP
36 lines
591 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Models\Market;
|
|
|
|
use App\Models\Model;
|
|
use App\Models\User;
|
|
|
|
class Cart extends Model
|
|
{
|
|
protected ?string $table = 'carts';
|
|
|
|
protected array $fillable = [
|
|
'hashkey',
|
|
'user_id',
|
|
'is_active',
|
|
'created_by',
|
|
'updated_by',
|
|
];
|
|
|
|
protected array $casts = [
|
|
'is_active' => 'boolean',
|
|
];
|
|
|
|
public function items()
|
|
{
|
|
return $this->hasMany(CartItem::class, 'cart_id');
|
|
}
|
|
|
|
public function user()
|
|
{
|
|
return $this->belongsTo(User::class, 'user_id');
|
|
}
|
|
}
|