システム管理者用のログインページで利用するレイアウトのためのコンポーネントを作成します.これは app/View/Components ディレクトリにある GuestLayout.php をコピーして適宜変更すると良いでしょう.
app/View/Components/GuestadminLayout.php
<?php
namespace App\View\Components;
use Illuminate\View\Component;
use Illuminate\View\View;
class GuestadminLayout extends Component
{
/**
* Get the view / contents that represents the component.
*/
public function render(): View
{
return view('layouts.guestadmin');
}
}
同時に,ログイン後のレイアウトのためのコンポーネントもここで作成しておきます.これも app/View/Components ディレクトリにある AppLayout.php をコピーして適宜変更すると良いでしょう.
app/View/Components/AdminLayout.php
<?php
namespace App\View\Components;
use Illuminate\View\Component;
use Illuminate\View\View;
class AdminLayout extends Component
{
/**
* Get the view / contents that represents the component.
*/
public function render(): View
{
return view('layouts.admin');
}
}
上の2つのコードのどちらも15行目では,layouts ディレクトリの guestadmin.blade.php や admin.blade.php をビューとして使うことを意味しています.次のページではそれらのファイルを作成します.