Level 50
you're passing in ->with('alerts', $alerts); so instead of session('alerts') use just $alerts and $alerts['message'] respectively
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
''' public function index() { $data = User::find('id');
$alerts = array('message'=>'Down Time of System', 'cls'=> 'success');
return view('client.dashboard',['data' => $data])->with('alerts',$alerts);
} '''
in view
'''
@if(session('alerts'))
<div class="m-alert m-alert--outline m-alert--outline-2x alert alert-{{session('alerts.cls')}} alert-dismissible fade show"
role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
</button>
{{session('alerts.message')}}
</div>
@endif '''
alerts not working not and no error show ... any help how i can get seesion value
You forgot to add the array into the session.
change this
$alerts = array('message'=>'Down Time of System', 'cls'=> 'success');
return view('client.dashboard',['data' => $data])->with('alerts',$alerts);
to
session()->flash('alerts', ['message'=>'Down Time of System', 'cls'=> 'success']);
return view('client.dashboard',['data' => $data]);
Please or to participate in this conversation.