fix : 테이블 추가 및 수정
- 신규 (user_roles, user_tenants) - 수정 (roles, tenants, users)
This commit is contained in:
@@ -6,37 +6,29 @@
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Laravel\Fortify\TwoFactorAuthenticatable;
|
||||
use Laravel\Sanctum\HasApiTokens;
|
||||
use App\Traits\UppercaseAttributes;
|
||||
|
||||
class User extends Authenticatable
|
||||
{
|
||||
use HasApiTokens, Notifiable, TwoFactorAuthenticatable;
|
||||
use HasApiTokens, Notifiable, TwoFactorAuthenticatable, SoftDeletes;
|
||||
|
||||
protected $table = 'members'; // 테이블 이름 변경
|
||||
|
||||
protected $primaryKey = 'mb_id'; // 기본 키 변경
|
||||
|
||||
protected $fillable = [
|
||||
'mb_id', 'mb_pass', 'mb_name', 'mb_phone', 'mb_mail',
|
||||
'email_verified_at', 'mb_type', 'mb_level', 'last_login',
|
||||
'reg_date', 'remember_token'
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'mb_pass', 'remember_token',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'reg_date' => 'datetime',
|
||||
];
|
||||
|
||||
public function getAuthPassword()
|
||||
public function userTenants()
|
||||
{
|
||||
return $this->mb_pass; // 기본 비밀번호 필드를 mb_pass로 설정
|
||||
return $this->hasMany(UserTenant::class);
|
||||
}
|
||||
|
||||
public function getAuthIdentifierName()
|
||||
public function tenants()
|
||||
{
|
||||
return 'mb_id'; // 기본 로그인 필드를 mb_id로 변경
|
||||
return $this->belongsToMany(Tenant::class, 'user_tenants');
|
||||
}
|
||||
|
||||
public function userRoles()
|
||||
{
|
||||
return $this->hasMany(UserRole::class);
|
||||
}
|
||||
|
||||
public function roles()
|
||||
{
|
||||
return $this->belongsToMany(Role::class, 'user_roles')
|
||||
->withPivot('tenant_id', 'assigned_at');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user