-
Root View 변경하는법 (루트 뷰, 레이아웃)Laravel/Inertia.js 2022. 8. 27. 13:45반응형SMALL
# What?
- 한 사이트 내 다른 레이아웃 2개를 사용하고싶을 때 url에 따른 레이아웃 변경 필요
# How?
@HandleInertiaRequests.php
protected $rootView = 'app'; ... public function rootView(Request $request) { if(str_contains($request->path(), "shopping")) $this->rootView = "shopping"; else $this->rootView = "brand"; return parent::rootView($request); // TODO: Change the autogenerated stub }
@ resources/views에 brand.blade.php, shopping.blade.php 만들어서 원하는 레이아웃 구성하기
LIST'Laravel > Inertia.js' 카테고리의 다른 글
로그인 후 view layout 안바뀔 때 (redirect intended 쓰면 안됨) #멀티레이아웃 #layout (0) 2023.01.29 lang, translate, locale, 다국어, global 언어 지원하기(laravel + inertia.js + nuxt 버전 추가) (0) 2022.10.29 Infinite Scroll 구현 (더보기) (0) 2022.06.17 Inertia.js에서 AOS 사용하는법 (0) 2022.05.21 Inertia.js 외부링크로 redirect하는법(결제 요청 시 필요) (0) 2022.05.13