Добрый день, есть роут
Route::get('/search','ArchiveController@search');
Есть функция search в контроллере ArchiveController
protected function search(Request $request){
$search = $request->search;
$style_s = $request->style;
$country_s = $request->country;
$year = $request->year;
$author = $request->author;
$albums_count = DB::table('archive')->count();
$albums = DB::table('archive')->when($search, function ($query) use ($search) {
return $query->where('artist', $search);
})->when($style_s, function ($query) use ($style_s) {
return $query->where('style', $style_s);
})->when($country_s, function ($query) use ($country_s) {
return $query->where('country', $country_s);
})->when($year, function ($query) use ($year) {
return $query->where('year', $year);
})->when($author, function ($query) use ($author) {
return $query->where('author', $author);
})->orwhere('album', $search)->orderby('id',false)->paginate(9) ;
$country = Country::all('name')->sortBy('name');
$year = Year::all('name')->sortByDesc('name');
$style = Style::all('name')->sortBy('name');
return view('albums.index', ['albums' => $albums, 'albums_count' => $albums_count, 'style' => $style, 'country' => $country, 'year' => $year]);
}
И вьюха
<form class="form-inline" method="get" id="search" action="/search">
При таком раскладе все замечательно работает, но стоит изменить вьюху на
<form class="form-inline" method="get" id="search" action="/albums/search">
и роут на
Route::get('/albums/search','ArchiveController@search');
То уже ничего не ищется. В чем проблема?