I've tried searching for a way to do this with Laravel, and i'm sure it's more than capable (Maybe i've been searching for it using incorrect terms)..
I'm trying to extract table data to be used in Laravels built-in form creator:
$clusters = Cluster::get(array('id','name'));
Into:
{{ Form::select('cluster', $clusters,Input::old('cluster'), array('id' => 'cluster')) }}
But currently, I get a dropdown with JSON in it, and if I use toArray() it doesn't use the ID numbers from the JSON array, it applies new ID numbers, then puts the data in an array:
Can anyone point me in the right direction to form arrays properly from Eloquent extractions? I've been using this bit of code which feels meaningless:
$clust = array();
foreach($clusters as $key => $cl) {
$clust[$cl['id']] = $cl['location'];
}
Thanks