Easy way to create multiple flash messages in laravel-9
P粉969253139
P粉969253139 2024-03-27 14:58:46
0
1
554

Is there a way to simplify these three lines to create multiple flash messages?

session()->flash('status', 'error');
session()->flash('title', 'test title');
session()->flash('message', 'test message');

I tried it but it doesn’t work

return view('panel.codes.CodeCrud.create', [
   'categories' => collect(),
   'cards' => collect(),
])->with([
   'status' => 'error',
   'title' => 'test title',
   'message' => 'test message',
]);

P粉969253139
P粉969253139

reply all(1)
P粉852114752

You can pass an array as the second parameter to session()->flash

session()->flash('status', ['status' => 'error', 'title' => 'test title']);
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template