Question: Currently this is storing only first\_name in session. I need to store some other fields which are in the same database row like user\_role and city. How can I do that ?

**DashboardContaroller.php**

```
public function getIndex( Request $request )
    {
        $this->data['firstNames'] = \DB::table('tb_users')->orderBy('first_name')->lists('first_name', 'first_name');
        Session::put('firstName', $request->get('first_name'));     
        return view('dashboard.index',$this->data);
    }

```

**index.blade.php**

```
<form action="" method="post">
{!! Form::select('first_name', $firstNames) !!}
<button type="submit" value="Submit">Go</button>
</form>

```

**View**

```
<p>{{Session::get('firstName','default value')}}</p>

```

Answer: 
You can store the object of the user, for example 

```
public function getIndex( Request $request )
{
    $this->data['firstNames'] = \DB::table('tb_users')->orderBy('first_name')->lists('first_name', 'first_name');
    Session::put('userData', ['firstName' => $request->get('first_name'), 'id' => $request->get('id')]);     
    return view('dashboard.index',$this->data);
}

```
Here You Go

**DashboardContaroller.php**

```
public function getIndex( Request $request )
{
    $this->data['firstNames'] = \DB::table('tb_users')->orderBy('first_name')->lists('first_name', 'first_name');
    Session::put('user', $request->all());     
    return view('dashboard.index',$this->data);
}

```

In your View either iterate over the data like this:

```
@foreach (Session::get('user') as $user)
     {{$user}}
@endforeach

```

Or use specific keys like 

```
{{Session::get('user')['first_name']}}

```