Init: Hoan thanh kien truc V3 va Filament UI
This commit is contained in:
27
app/Models/Customer.php
Normal file
27
app/Models/Customer.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Concerns\HasUuids;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Customer extends Model
|
||||
{
|
||||
use HasUuids, HasFactory;
|
||||
|
||||
protected $guarded = [];
|
||||
|
||||
// Ép kiểu để Laravel tự động dịch JSON thành Mảng khi hiển thị lên Form
|
||||
protected $casts = [
|
||||
'address' => 'array',
|
||||
'dob' => 'date',
|
||||
];
|
||||
|
||||
public function contracts()
|
||||
{
|
||||
return $this->belongsToMany(Contract::class, 'contract_customers')
|
||||
->withPivot('role', 'transfer_order')
|
||||
->withTimestamps();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user