Support the ongoing development of Laravel.io →
Input Forms

Hi, in my controllers edit function, I pass my view the following

$csUsers = User::lists('userName', 'id');

And then I can display the users, with the user which was previously selected and saved to the database set as the selected option

{!! Form::select('csManager', $csUsers, Input::old('csUsers'), ['class' => 'csManager']) !!}

However, I need to pass it a list of users with a specific departmentId. If I do

$csUsers = User::select('userName', 'id')->where('departmentId', 3)->get();

My select displays the whole array instead of just the name e.g. {"userName":"Nick", "id":1}

How would I go about getting it to display the name properly?

Thanks

Last updated 3 years ago.
0

Sign in to participate in this thread!

PHPverse

Your banner here too?

nick2price nick2price Joined 20 Jan 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.