Update source into github
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Order extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'order';
|
||||
|
||||
public $timestamps = true;
|
||||
|
||||
// protected $fillable = [
|
||||
// 'order_num',
|
||||
// 'customer_id',
|
||||
// 'date',
|
||||
// 'payment_id',
|
||||
// 'discount_id',
|
||||
// 'discount_value',
|
||||
// 'invoice_id',
|
||||
// 'user_id',
|
||||
// 'amount',
|
||||
// 'note',
|
||||
// 'client_ip',
|
||||
// 'status'
|
||||
// ];
|
||||
|
||||
protected $guarded = [];
|
||||
public function customer()
|
||||
{
|
||||
return $this->belongsTo(\App\Models\Customer::class);
|
||||
}
|
||||
public function discount()
|
||||
{
|
||||
return $this->belongsTo(\App\Models\Discount::class);
|
||||
}
|
||||
|
||||
public function invoice()
|
||||
{
|
||||
return $this->belongsTo(\App\Models\Invoice::class, 'invoice_id', 'id');
|
||||
}
|
||||
|
||||
public function payment()
|
||||
{
|
||||
return $this->belongsTo(\App\Models\Payment::class);
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(\App\Models\User::class);
|
||||
}
|
||||
|
||||
public function orderItem()
|
||||
{
|
||||
return $this->belongsToMany(\App\Models\InvoiceItem::class, 'order__order_item', 'order_id', 'invoice_item_id');
|
||||
}
|
||||
|
||||
public function orderItems()
|
||||
{
|
||||
return $this->hasMany(OrderItem::class, 'order_id');
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user