New Initial Commit
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Concerns\HasUuids;
|
||||
|
||||
class Order extends Model
|
||||
{
|
||||
use HasUuids;
|
||||
|
||||
protected $primaryKey = 'uuid';
|
||||
protected $keyType = 'string';
|
||||
public $incrementing = false;
|
||||
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'order_number',
|
||||
'total',
|
||||
'status',
|
||||
'payment_method',
|
||||
'payment_status',
|
||||
'customer_name',
|
||||
'customer_email',
|
||||
'customer_phone',
|
||||
'shipping_address',
|
||||
'notes'
|
||||
];
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public function items()
|
||||
{
|
||||
return $this->hasMany(OrderItem::class, 'order_id', 'uuid');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user