- 라우트 파라미터 충돌 수정 (Layer 4 확장) - TenantScope 글로벌 스코프가 테넌트 콘솔에서 올바른 tenant_id 사용하도록 수정 - 감사로그 상세 테넌트 콘솔 레이아웃 적용 - 테넌트 전환: 모달 → 컨텍스트 메뉴로 이동, 스타일 변경 (녹색+전환아이콘) - 테넌트 전환 이벤트를 openTenantConsole 호출로 통일 - 사이드바 스타일 메인과 통일 + 리포트 주의사항 정리
59 lines
1.4 KiB
PHP
59 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Models\Tenants\TenantSetting;
|
|
use App\Services\TenantService;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Response;
|
|
use Illuminate\View\View;
|
|
|
|
class TenantController extends Controller
|
|
{
|
|
public function __construct(
|
|
private readonly TenantService $tenantService
|
|
) {}
|
|
|
|
/**
|
|
* 테넌트 목록 (Blade 화면)
|
|
*/
|
|
public function index(Request $request): View|Response
|
|
{
|
|
// HTMX 요청 시 전체 페이지 리로드 (스크립트 실행 필요)
|
|
if ($request->header('HX-Request')) {
|
|
return response('', 200)->header('HX-Redirect', route('tenants.index'));
|
|
}
|
|
|
|
return view('tenants.index');
|
|
}
|
|
|
|
/**
|
|
* 테넌트 생성 화면
|
|
*/
|
|
public function create(): View
|
|
{
|
|
return view('tenants.create');
|
|
}
|
|
|
|
/**
|
|
* 테넌트 수정 화면
|
|
*/
|
|
public function edit(int $id): View
|
|
{
|
|
$tenant = $this->tenantService->getTenantById($id);
|
|
|
|
if (! $tenant) {
|
|
abort(404, '테넌트를 찾을 수 없습니다.');
|
|
}
|
|
|
|
$displayCompanyName = TenantSetting::withoutGlobalScopes()
|
|
->where('tenant_id', $id)
|
|
->where('setting_group', 'company')
|
|
->where('setting_key', 'display_company_name')
|
|
->first()?->setting_value ?? '';
|
|
|
|
return view('tenants.edit', compact('tenant', 'displayCompanyName'));
|
|
}
|
|
|
|
}
|