83 lines
1.8 KiB
PHP
83 lines
1.8 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace Modules\Restaurant\Models;
|
||
|
|
|
||
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||
|
|
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||
|
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||
|
|
use Illuminate\Notifications\Notifiable;
|
||
|
|
use Laravel\Passport\HasApiTokens;
|
||
|
|
use Spatie\Permission\Models\Role;
|
||
|
|
use Spatie\Permission\Traits\HasRoles;
|
||
|
|
|
||
|
|
class Customer extends Authenticatable
|
||
|
|
{
|
||
|
|
use HasApiTokens, HasRoles, Notifiable, SoftDeletes;
|
||
|
|
|
||
|
|
protected $fillable = [
|
||
|
|
'restaurant_id',
|
||
|
|
'customer_code',
|
||
|
|
'name',
|
||
|
|
'username',
|
||
|
|
'email',
|
||
|
|
'phone',
|
||
|
|
'password',
|
||
|
|
'otp_code',
|
||
|
|
'role_id',
|
||
|
|
'isVerified',
|
||
|
|
'email_verified_at',
|
||
|
|
'avatar',
|
||
|
|
'address',
|
||
|
|
'gender',
|
||
|
|
'date_of_birth',
|
||
|
|
'nid',
|
||
|
|
'platform',
|
||
|
|
'device_info',
|
||
|
|
'last_active_time',
|
||
|
|
'meta',
|
||
|
|
'status',
|
||
|
|
];
|
||
|
|
|
||
|
|
public const TABLE_NAME = 'customers';
|
||
|
|
|
||
|
|
protected $table = self::TABLE_NAME;
|
||
|
|
|
||
|
|
protected $guard_name = 'customer';
|
||
|
|
|
||
|
|
/**
|
||
|
|
* The attributes that should be hidden for serialization.
|
||
|
|
*
|
||
|
|
* @var list<string>
|
||
|
|
*/
|
||
|
|
protected $hidden = [
|
||
|
|
'password',
|
||
|
|
'remember_token',
|
||
|
|
];
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Get the attributes that should be cast.
|
||
|
|
*
|
||
|
|
* @return array<string, string>
|
||
|
|
*/
|
||
|
|
protected function casts(): array
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
'email_verified_at' => 'datetime',
|
||
|
|
'password' => 'hashed',
|
||
|
|
'meta' => 'array',
|
||
|
|
'last_active_time' => 'datetime',
|
||
|
|
];
|
||
|
|
}
|
||
|
|
|
||
|
|
public function role(): HasOne
|
||
|
|
{
|
||
|
|
return $this->hasOne(Role::class, 'id', 'role_id');
|
||
|
|
}
|
||
|
|
|
||
|
|
public function orders(): HasMany
|
||
|
|
{
|
||
|
|
return $this->hasMany(Order::class);
|
||
|
|
}
|
||
|
|
}
|