Laravel - Displaying message data passed to a view
You won't be able to send variables , but you can flash some session data.
If you need to keep your flash data around for several requests, you may use the reflash method, which will keep all of the flash data for an additional request.
To store data in session :
$request->session()->put('message', 'project successfully created');return redirect('/projects');
to get that data in the view :
{{ session('message') }}
To return message passed in a view in laravel, you have to do the below procedure
@if($message = Session::get('message')){<div class="alert alert-success"> <p>{{$message}}</p></div>}
the session is getting the message you passed in to the view and displaying it on the relevant page.
for me, if ii have to pass the message to the view, i normally do it in this way
return redirect()->route('/project')->with('message', 'project successfully created');