fix : User 모델 경로 오류로 인해 User 모델만 밖으로 이동
This commit is contained in:
@@ -1,53 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Members;
|
||||
|
||||
use App\Models\Commons\Role;
|
||||
use App\Models\File;
|
||||
use App\Traits\ModelTrait;
|
||||
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, 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);
|
||||
}
|
||||
|
||||
public function files()
|
||||
{
|
||||
return $this->morphMany(File::class, 'fileable');
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Models\Members;
|
||||
|
||||
use App\Models\Commons\Menu;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class UserMenuPermission extends Model
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
use App\Models\Commons\Role;
|
||||
use App\Models\Tenants\Tenant;
|
||||
use App\Models\User;
|
||||
use App\Traits\BelongsToTenant;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Models\Members;
|
||||
|
||||
use App\Models\Tenants\Tenant;
|
||||
use App\Models\User;
|
||||
use App\Traits\BelongsToTenant;
|
||||
use App\Traits\ModelTrait;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
Reference in New Issue
Block a user