2
I want to send a variable from one route to another, to display this variable in the view, use example:
public function create(ExamRequest $request)
{
Exam::create( $request->all() );
$message = 'A avaliação "'.$request->input('name').'" foi registrada!';
return redirect()->route('exams')->withMessage($message);
}
The route exams
in my case calls a view
, and I try to display the parameter in the same way:
<div class="row text-success text-center">
{{ isset($message) ? $message : '' }}
</div>
But nothing is ever displayed, as I can send a parameter to another route?
PS: I know with view works, example view('exams')->withMessage($message);
, but in case does not change the browser link, and I want that link to stick.
I don’t like the conventional way.
– Diego Souza
Though I use sometimes.
– Diego Souza
I took the "conventional" because it got a little strange. Actually, Laravel has a thousand ways to use the same function, kkkkkkkkk
– Wallace Maxters
There’s nothing. There must be less than 10.
– Diego Souza
with([flash' => $message])
,with('flash', $message)
,withFlash($message)
,session()->flash('flash', $message)
,session()->flash(['flash' => $message])
... tired...– Wallace Maxters
So there’s five of you...
– Diego Souza