thanks for reading.
I have a method that take data from a table, with an orderByRaw sentence.
Everything is ok unless when I want to do a pagination, which without the orderByRaw works perfectly.
I've seen here a solution: https://stackoverflow.com/questions/21207222/laravel-pagination-links-not-appearing#= but I wanted to know if there is another better solution.
My controller looks like this:
public function search() {
$parameters = Input::get('a');
$query = Project::whereRaw("MATCH(name, description_es, description_en, resources_es, resources_en, base_address, addresses) AGAINST(? IN BOOLEAN MODE)", array($parameters));
$query->orderByRaw("MATCH(name, description_es, description_en, resources_es, resources_en, base_address, addresses) AGAINST(? IN BOOLEAN MODE) DESC", array($parameters));
if (Input::get('selfmanaged')) {
$query->where('selfmanaged', 1);
}
if (Input::get('vegan')) {
$query->where('vegan', 1);
}
$projects = $query->paginate(5);
return View::make('list', compact('projects', 'parameters'));
}
And in the view I have:
<div id='pagination'>{{ $projects->appends(array('a' => $parameters))->links() }}</div>
Thank you so much for your time!