表題のとおりですが、Handler.phpでステータスコードが404の時errorを表示するbladeに飛ばしているのですが、bladeでAuth::user()が取れません。
普通のcontrollerからerrorのbladeに飛ばした時は取得できているのですが。。。
また、Handler.php内でもAuth::user()が取得できません。
対処方法があれば教えていただけますでしょうか。
ソースコード
php
1// Handler.php 2use Auth; 3public function render($request, Exception $exception) 4 if ($this->isHttpException($exception)) { 5 switch ($exception->getStatusCode()) { 6 case 404: 7 return response()->view('errors'); 8 } 9 } 10 return parent::render($request, $exception); 11
php
1// errors.blade.php 2<?php 3 if (Auth::user() != null){ 4 echo Auth::user(); 5 } 6?> 7 8
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。