11
I understand you can send values to a select statement like this:
Controller:
$client = Client::lists('name', 'id');
return View::make('index', compact('client'));
And populate this in my view like so:
View:
{{ Form::select('client_id', $client, Input::old('client_id')) }}
But how do I populate only records from Clients where group_id = 1 for example.
I tried:
$client = Client::lists('name', 'id')->where('group_id', 1)->get();
and
$client = Client::lists('name', 'id')->where('group_id','=', 1)->get();
But it doesn't seem to work like that and gives me the error "Call to a member function where() on a non-object"
Any ideas on how to make it work?