Init: Hoan thanh kien truc V3 va Filament UI
This commit is contained in:
26
app/Models/Contract.php
Normal file
26
app/Models/Contract.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Concerns\HasUuids;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Contract extends Model
|
||||
{
|
||||
use HasUuids, HasFactory;
|
||||
|
||||
protected $guarded = [];
|
||||
|
||||
// 1 Hợp đồng thuộc về 1 Sản phẩm
|
||||
public function product()
|
||||
{
|
||||
return $this->belongsTo(Product::class);
|
||||
}
|
||||
|
||||
// 1 Hợp đồng có thể có nhiều Khách hàng (Đồng sở hữu)
|
||||
public function customers()
|
||||
{
|
||||
return $this->belongsToMany(Customer::class, 'contract_customers')->withPivot('role', 'transfer_order')->withTimestamps();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user