customer section

This commit is contained in:
Abhishek Mali
2025-11-18 10:01:59 +05:30
parent df89031d36
commit 63daef6a92
10 changed files with 664 additions and 12 deletions

View File

@@ -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()
{