I have a search form which users enter and I filter out the data then paginate. The problem is I when I paginate Laravel returns entire result
$searchFilter = arrray('id'=>true);
$building = new Building();
if (isset($searchFilter['id']))
{
$building->where('id','=', 6);
}
return $building->paginate(20);
In the table there exist only one row with id 6. Laravel returns all the rows of the table.
However If I don't paginate it will return only the row with id 6 I want it to return paginated with applying the where operation