Any idea of ever implementing a functionality to allow us to handle success messages the same way errors are dealt with?
Like this:
@if($successes->count() > 0)
@foreach($successes->all() as $success)
{{ $success }}
@endforeach
@endif
"successes" could have another name though.
I know that you could make your own method for doing so, or even create a similar implementation and use that. There might even be libraries that does this, but I still see it as a thing that the framework could handle by default. Just like you handle errors, you will usually handle successes too. ("You successfully created an account" - for example)
Again, I know that you can do it simply by doing:
Controller
...
return Redirect::to('some-site')->with('success', 'Done!');
...
View
@if( session('success') )
{{ session('success') }}
@endif
But a function like ->withSuccesses([ 'Done!' ]); would be so much easier and way prettier (+ allow autocompletion in the IDE)
———
I know that this question has been asked before, but I decided to give it a shot again.
The redirector actually supports dynamic withs, so you could do withSuccess('Done') or withSuccesses(['Done']) and access them from the session as success and successes.
What?! How can they have thought of every little detail... I love Laravel.
Thanks! :o)
On 17. maj 2016, at 09.09, Dwight Watson [email protected] wrote:
The redirector actually supports dynamic withs, so you could do withSuccess('Done') or withSuccesses(['Done']) and access them from the session as success and successes.
—
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
@GrahamCampbell, if this is solved, why is it still open?
@mustafaaloko Because @LasseRafn didn't close it?
Most helpful comment
What?! How can they have thought of every little detail... I love Laravel.
Thanks! :o)