Laravel 5.2
Hello I have this message in my controller:
public function postIndex(SaveProfileRequest $request) { $profile = Profile::create([ 'name' => $request->input('name') ]);
if($profile->id) {
return redirect()->back()->with('message', [
'type'=> 'success',
'message' => 'Успешно записан нов профил!'
]);
}
return redirect()->back()->with('message', [
'type'=> 'danger',
'message' => 'Профилът не е записан!'
]);
I'm displaying it like this in my view:
@if(Session::has('message')) {{ Session::get('message.message')}} @endif
But it doesn't show in the type i have selected in the controller, how can I format it?
Thank you!
Not working. I got this Undefined variable: message (View: C:\xampp\htdocs\school_system\resources\views\messages.blade.php) (View: C:\xampp\htdocs\school_system\resources\views\messages.blade.php)
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community