0
沒有laravel使用會話重定向不使用我怎樣才能成功或錯誤信息重定向會話
目前我使用的重定向下面的代碼:
return redirect('dashboard')->with('status', 'Profile updated!');
但是這個代碼需要會話才能顯示成功消息。
沒有laravel使用會話重定向不使用我怎樣才能成功或錯誤信息重定向會話
目前我使用的重定向下面的代碼:
return redirect('dashboard')->with('status', 'Profile updated!');
但是這個代碼需要會話才能顯示成功消息。
你可以像下面的狀態沿着設定另一個變量狀態類型,
return redirect('dashboard')->with(['status'=>'Profile updated!','status_type'=>'success']);
而在你的儀表板刀文件使用
@if(isset($status))
<p class="alert alert-{{ $status_type }}" >{{ $status }}</p>
@endif
如果你不想使用會話你會prabobly需要爲每個成功和錯誤創建兩個自定義頁面 – DevWL
如何顯示刀片上的「狀態」? –
爲什麼你不想使用會話?您可以通過獲取請求傳遞'''return redirect('dashboard?status = Profile + updated!');'' – aceraven777