Files
sam-manage/app/Models/User.php
hskwon 6c73571c0f fix: Tenant 모델 네임스페이스 참조 오류 수정
- ViewServiceProvider: App\Models\Tenant → App\Models\Tenants\Tenant
- User 모델에 tenant() 관계 추가
2025-11-24 08:50:44 +09:00

71 lines
1.6 KiB
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens;
class User extends Authenticatable
{
use HasApiTokens, HasFactory, Notifiable, SoftDeletes;
/**
* The attributes that are mass assignable.
*
* @var list<string>
*/
protected $fillable = [
'user_id',
'name',
'email',
'phone',
'password',
'options',
'profile_photo_path',
'role',
'is_active',
'is_super_admin',
];
/**
* The attributes that should be hidden for serialization.
*
* @var list<string>
*/
protected $hidden = [
'password',
'remember_token',
'two_factor_secret',
'two_factor_recovery_codes',
'two_factor_confirmed_at',
'deleted_at',
];
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'email_verified_at' => 'datetime',
'last_login_at' => 'datetime',
'password' => 'hashed',
'options' => 'array',
'is_active' => 'boolean',
'is_super_admin' => 'boolean',
];
}
/**
* 관계: 테넌트
*/
public function tenant()
{
return $this->belongsTo(\App\Models\Tenants\Tenant::class, 'tenant_id');
}
}