Reputation: 3340
I have a problem with with
method in view
function. I would like to pass data variable and status. I do that:
return view('user.blogsettings')
->with(array('data' => $this->_data, 'status' => 'Save'));
Data item from array works ok, but status is not
@if (session('status'))
<div class="alert alert-success">
{{ session('status') }}
</div>
@endif
There is no message.
Upvotes: 0
Views: 180
Reputation: 7334
The with()
method on View
doesn't send to session, it passes it as variable to the view so you can access it as $status
instead of session('status')
If you want to explicitly add it to session then use session(['status' => 'Save'])
and this would be flashed to the session for the ongoing request.
You may check Laravel's doc Passing Data to view for further information
I hope this is useful.
Upvotes: 1