customer section
This commit is contained in:
@@ -15,7 +15,7 @@ class User extends Authenticatable implements JWTSubject
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected $fillable = [
|
||||
'customer_id', // CID-2025-000001 format
|
||||
'customer_id',
|
||||
'customer_name',
|
||||
'company_name',
|
||||
'designation',
|
||||
@@ -25,10 +25,15 @@ class User extends Authenticatable implements JWTSubject
|
||||
'pincode',
|
||||
'date',
|
||||
'password',
|
||||
|
||||
// newly added customer fields
|
||||
'status', // active / inactive
|
||||
'customer_type', // premium / regular
|
||||
'profile_image', // optional image
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be hidden for arrays.
|
||||
* Attributes that should be hidden.
|
||||
*/
|
||||
protected $hidden = [
|
||||
'password',
|
||||
@@ -36,7 +41,7 @@ class User extends Authenticatable implements JWTSubject
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast.
|
||||
* Attribute casting.
|
||||
*/
|
||||
protected function casts(): array
|
||||
{
|
||||
@@ -47,7 +52,30 @@ class User extends Authenticatable implements JWTSubject
|
||||
}
|
||||
|
||||
/**
|
||||
* JWT Identifier.
|
||||
* Relationship: User → MarkList (Many)
|
||||
*/
|
||||
public function marks()
|
||||
{
|
||||
return $this->hasMany(\App\Models\MarkList::class, 'customer_id', 'customer_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Relationship: User → Orders (Through MarkList)
|
||||
*/
|
||||
public function orders()
|
||||
{
|
||||
return $this->hasManyThrough(
|
||||
\App\Models\Order::class,
|
||||
\App\Models\MarkList::class,
|
||||
'customer_id', // MarkList.customer_id
|
||||
'mark_no', // Orders.mark_no
|
||||
'customer_id', // Users.customer_id
|
||||
'mark_no' // MarkList.mark_no
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* JWT Identifier
|
||||
*/
|
||||
public function getJWTIdentifier()
|
||||
{
|
||||
@@ -55,7 +83,7 @@ class User extends Authenticatable implements JWTSubject
|
||||
}
|
||||
|
||||
/**
|
||||
* JWT Custom Claims.
|
||||
* JWT Custom Claims
|
||||
*/
|
||||
public function getJWTCustomClaims()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user