@remigis Please provide more code, your view etc.
Sep 13, 2019
4
Level 1
return view()->with();
if ($data["errors"]["count"] == 0) {
return view("counter", $data)->with('success', [
"Action completed with 0 errors"
]);
}
everything is working, but success message is not displayed. Maybe someone knows why?
Level 73
Yes, because when you use with on a Response object it adds to a flash session, but when used on a view, it passes it as a parameter as I've shown you above. You can open the underlying functions in your IDE and see how they are implemented.
One is in Iluminate\Http\RedirectResponse and the other in Illuminate\View\View. Same name for the method, different implementation.
If you want to keep using the session, then add this before you return the view:
session()->flash('success', 'Action completed with 0 errors');
return view("counter", $data);
1 like
Please or to participate in this conversation.