I want to use the switch before using paginate. But am getting this error in my view -
Call to undefined method Illuminate\Database\Eloquent\Builder::links().
My Code - MyController.php
$var = User::select('somefield', 'anotherfield');
switch($condition){
case foo:
$var->where('bar', '=', 'xyz');
break;
case etc:
$var->where('bar', '=', 'abc')
break;
}
$var->paginate(10);
return View::make('x.y.z', compact('var'));
You need to catch in some variable as,
In your current code, you are not saving paginated result anywhere.