fix : 모델 경로 수정

This commit is contained in:
2025-07-29 13:00:25 +09:00
parent d5e94bc698
commit 1942f51cf7
55 changed files with 199 additions and 344 deletions

View File

@@ -1,46 +0,0 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens;
use App\Traits\ModelTrait;
class User extends Authenticatable
{
use HasApiTokens, Notifiable, SoftDeletes, ModelTrait;
protected $hidden = [
'password', 'remember_token',
'two_factor_secret', 'two_factor_recovery_codes', 'two_factor_confirmed_at'
];
public function userTenants()
{
return $this->hasMany(UserTenant::class);
}
public function userTenant() // 단일 기본 테넌트
{
// 예시: 첫 번째(기본) 테넌트 반환
return $this->hasOne(UserTenant::class)->where('is_active', 1);
}
public function userRoles()
{
return $this->hasMany(UserRole::class);
}
public function roles()
{
return $this->belongsToMany(Role::class, 'user_roles')
->withPivot('tenant_id', 'assigned_at');
}
public function userTenantById($tenantId)
{
return $this->hasOne(UserTenant::class)->where('tenant_id', $tenantId);
}
}