I am trying to store the $user array in session but only id is stored in session. How can I put the first_name and last_name also ?
public function getIndex( Request $request )
{
$this->data['firstNames'] = \DB::table('tb_users')->orderBy('first_name')->lists('first_name', 'id');
$user = User::where('id', '=', $request->get('id'))->get()->toArray();
Session::put('user', [ 'id' => $request->get('id'), 'last_name' => $request->get('last_name'), 'first_name' => $request->get('first_name'), ]);
return view('dashboard.index',$this->data)->with('user', $user);
}
This is the select form
<form action="" method="post">
{!! Form::select('id', $firstNames) !!}
<button type="submit" value="Submit">Go</button>
</form>