#In Controller
use Session;
Session::flash('message', "Special message goes here");
return Redirect::back();
#In View
@if (Session::has('message'))
<div class="alert alert-info">{{ Session::get('message') }}</div>
@endif
@if (Session::has('success'))
<div class="alert alert-success">
<ul>
<li>{!! Session::get('success') !!}</li>
</ul>
</div>
@endif
return redirect()->back()->with('success', 'your message,here');
return redirect()->route('agent')->with(
'success', __('Agent successfully added!')
);
return redirect()->back()->with('error', __('Permission Denied.'));
create validation errors
<!-- /resources/views/post/create.blade.php -->
<h1>Create Post</h1>
@if ($errors->any())
<div class="alert alert-danger">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<!-- Create Post Form -->
##error message:
<!-- /resources/views/post/create.blade.php -->
<label for="title">Post Title</label>
<input id="title" type="text" name="title" class="@error('title') is-invalid @enderror">
@error('title')
<div class="alert alert-danger">{{ $message }}</div>
@enderror