i am trying to create search for my dashbord where have 4 field,
so i can search one by one or both at the same time name, age, location, phone, i wrote a code but its not working
$q = Model::query();
if (Input::has('name'))
{
$q->where('name',Input::get('name'));
}
if (Input::has('age'))
{
$q->where('age',Input::get('age'));
}
if (Input::has('location'))
{
$q->where('location', Input::get('location'));
}
if (Input::has('phone'))
{
$q->where('phone', Input::get('phone'));
}
Getting empty output:
[]