Add hash for url in Laravel using pagination
My route:
Route::get('/app/search', ['as' => 'search', 'uses' => 'AppController@getSearch']);
My controller:
public function getSearch()
{
$searchTerm = Input::get('s');
$locs = Loc::whereRaw('match(title, description) against(? in boolean mode)', [$searchTerm])
->paginate(10);
$locs->getFactory()->setViewName('pagination::slider');
$locs->appends(['s' => $searchTerm]);
$this->layout->with('title', 'Search: ' . $searchTerm);
$this->layout->main = View::make('home')
->nest('content', 'index', ($locs->isEmpty()) ? ['notFound' => true] : compact('locs'));
}
I get the url: "www.example.com/app/search?s=search+term"
I would like to get: "www.example.com/app/search?s=search+term#result" to go directly to the result item.
I tried using $locs->fragment('result')->links();
both in controller and view, but nothing changed.
People are asking for more information to show where the url is generated, but the problem is I don't know that. Neither Route, nor Controller, nor View responds to this.
What's strange is that I can't figure out how the url is generated, I thought that:
$locs->appends(['s' => $searchTerm]);
responsible for this, but even if I remove this line nothing changes in the url. So I'm really stuck on this, the laravel docs doesn't help and I can't find any docs or help on the internet.
source to share
No one has answered this question yet
Check out similar questions: