Thursday, March 16, 2017

Laravel 5.4 pluck

I have a problem with the laravel5.4 pluck function. I need to obtain a list (to be used in a form::select) whit a list of cities (cap_citta) and the corresponding zip codes (cap_cap) as keys. In my code I have the following line:

$items = Cap::pluck('cap_citta', 'cap_cap');

The problem is that I obtain only a partial list. If instead I write only

$items = Cap::pluck('cap_citta');

everything goes right (but I'm missing the keys).

I would really appreciate your help.



via dds ss

Advertisement