0

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.

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.