38 lines
741 B
PHP
38 lines
741 B
PHP
<?php
|
|||
|
|
|
||
|
|
namespace App\Models;
|
||
|
|
|
||
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||
|
|
use Illuminate\Database\Eloquent\Model;
|
||
|
|
|
||
|
|
class Cart extends Model
|
||
|
|
{
|
||
|
|
use HasFactory;
|
||
|
|
protected $table = 'cart';
|
||
|
|
protected $fillable = [
|
||
|
|
'customer_id',
|
||
|
|
'sts',
|
||
|
|
'session_id',
|
||
|
|
'created_at',
|
||
|
|
'updated_at',
|
||
|
|
];
|
||
|
|
|
||
|
|
static $STS = [
|
||
|
|
1=>'در انتظار ثبت',
|
||
|
|
2=>'در انتظار پرداخت',
|
||
|
|
3=>'پرداخت شده',
|
||
|
|
4=>'لغو شده',
|
||
|
|
];
|
||
|
|
|
||
|
|
public function items()
|
||
|
|
{
|
||
|
|
return $this->hasMany(CartItem::class, 'cart_id');
|
||
|
|
}
|
||
|
|
|
||
|
|
protected function serializeDate(\DateTimeInterface $date)
|
||
|
|
{
|
||
|
|
return $date->format('Y-m-d H:i:s');
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|