last day (15 days later) » 

20:25
stackoverflow.com/questions/25674361/… i posted a question about that placeholder error, if youre interested
hi!
it all depends on what you get from $this->project->getClients();
hi!
can you show me what you get from \Log::info($this->project->getClients()) ?
actually:
\Log::info( (array) $this->project->getClients()) ?
#1 {main} [] []
[2014-09-04 20:32:37] production.INFO: array (
2 => 'Client 2',
1 => 'Client 1',
) [] []
[2014-09-04 20:32:50] production.INFO: array (
2 => 'Client 2',
1 => 'Client 1',
) [] []
[2014-09-04 20:32:53] production.INFO: array (
2 => 'Client 2',
1 => 'Client 1',
) [] []
its all correct
Just answered your question, I think I figured it out :)
you have to invert it to ->lists('id','client_name');
id comes first
20:35
but then in the front end it shows the id in the select
and then subsequently doesn't have the value id to find the clients projects
Is this what you need?
<select id="select_client" class=" tempus_select" name="client"><option value="1">Client One</option><option value="2">Client Two</option></select>
yes
this is how I got this
$client_options = [ 1 => 'Client One', 2 => 'Client Two'];
$select = Form::select('client', $client_options, Input::old('client'), array('id' => 'select_client', 'class' => ' tempus_select'));
I'm using your code
I just built the array manually here.
So if the array is correct, the Select should be too
Okay, I got the error
something related to lists()
nope still loads it incorrectly, it seems to be the array_merge
someone posted on my question saying array_merge resets the array keys, Use the + syntax to combine the arrays in order to retain their keys, or use something like array_unshift
And my answer was wrong :)
20:47
tbh i don't know whos right or wrong lol
$client_options = User::lists('name', 'id');
$select = Form::select('client', $client_options, Input::old('client'), array('id' => 'select_client', 'class' => ' tempus_select'));
this just gave me
<select id="select_client" class=" tempus_select" name="client"><option value="1">Conselho Regional de Psicologia</option><option value="2">Conselho Regional de Medicina</option></select>
your lists() was right
i know its when I do the array_merge the values are loaded incorrectly
yes the array merge reset the keys
yeah thats not good really
lol
so you should do $client_options = [0=>'Select a client'] + $client_options;
my bad
because I gave you the array_merge yesterday :/
20:50
no thats fine you aced it now though! :)
thanks for the help youre a star
haha
no problem, just edited my answer
thanks accepted the answer!
now i can crack on!
cool! good luck

last day (15 days later) »