I am new to laravel. I am trying to build a query from a select list. I am getting the following error
strtolower() expects parameter 1 to be string
Here is my form
<form action="search" method="post" accept-charset="utf-8">
<div class="form-group">
<select name="temptype" class="form-control">
<option value="" selected="selected">Select Temp Type</option>
<option value="hygienist" >Hygienist</option>
<option value="dentist" >Dentist</option>
<option value="dentalassistant" >Dental Assistant</option>
</select>
</div><!-- end username form group -->
</div><!-- end .modal-body -->
<div class="modal-footer">
<input type="submit" name="submit" class="btn btn-primary" />
</div>
</form>
Here is my route
Route::post('search', function(){
$temp = User::getTemps();
return $temp;
});
Here is the method in my user model...
public static function getTemps()
{
$type = array (
'hygienist' => Input::get('hygienist'),
'dentist' => Input::get('dentist'),
'dentalassistance' =>Input::get('dentalassistance')
);
$temps = DB::table('users')
->select('usertype', $type) <---- I think this has to be a string but my question is how do I make this dynamic... How do I pass the string value from what the user selects and pass it into the query?>
->get();
return $temps;
}