I have a form that takes two fields
SUBURB and STATE
and submits the fields to the URL eg.
www.mysite.com/?suburb=Manhatten&state=NY
In My Laravel Controller I have
if (isset($input['state']) && $input['state'] != '')
{
$query = $query->where('state', 'like', '%'. $input['state'].'%');
}
if (isset($input['suburb']) && $input['suburb'] != '')
{
$query = $query->where('suburb', 'like', '%'. $input['suburb'].'%');
}
I want to allow my users to add additional SUBURBS or STATES so they can get more results eg.
www.mysite.com/?suburb= Manhatten OR Brooklyn OR Queens &state= NY OR NJ
I don't know how I can setup my form to append a 'OR' to the additional suburbs and how do I setup my controller to look for the additional values?
OR, and then you can useexplode(' OR ', $input['state'])(then loop through the words and create a long query).