I
I
ildar-meyker2019-11-14 18:10:01
Laravel
ildar-meyker, 2019-11-14 18:10:01

$request->session()->flash() or Session::flash() or session()->flash(). What is more correct?

Is there a fundamental difference? Or is it a matter of taste?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vyacheslav Plisko, 2019-11-15
@ildar-meyker

That's right - do not use facades and magic helper functions that take the object of the request from the devil understand where. Such a short entry is given in the docks for clarity, while back in the 4th version, a convenient DI appeared that does not break IDE hints and does not crash the application when using reactphp.
Use $request->flash();
ps Looked at the doc https://laravel.com/docs/6.x/requests , none of the options you provided are there, where did you get them from?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question