OunknownO OunknownO - 2 months ago 5x
PHP Question

Form dropdown menu passing array as object

I'm trying to pass trough form dropdown selection but I can't pass array(the rest of the form is using objects. This is my code


$var->user = $request->users->id;


{!! Form::select('users', $users,null, ['placeholder' => 'Pick a user']) !!}

One solution is converting array to object using eloquent, how can that be done


If you want to get selected user's ID, I guess you need to do this:


You're getting "Trying to get property of non-object" error, because $request->users is not an object.