To redirect Back with error message on session
xxxxxxxxxx
//in Controller
return redirect('/route')->with('error', '*Please Select All Input before submit!');
//in blade view
@if (session('error'))
<div id="error-msg" class=" mx-auto alert alert-danger text-danger fw-bold">
{{ session('error') }}
</div>
@endif
xxxxxxxxxx
Route::post('user/profile', function () {
// Update the user's profile...
return redirect('dashboard')->with('status', 'Profile updated!');
});
xxxxxxxxxx
//redirct to previous page with message at a specific setion :)
return redirect(url()->previous() .'#comments')->with('success', 'Data Your Comment has been created successfully');