Здравствуйте, в админке есть страница с персоналом, пытаюсь реализовать поиск по странице. Роут для персонала (http://192.168.1.42:8080/admin_panel/personal) Вот так вот прописал активность формы <form method="get" action="{{ route('autocomplete-search.autocompleteSearch')}}"> В файле web.php ghjgbcfyj Route::resource('autocomplete-search',\App\Http\Controllers\Admin\PersonalController::class); Весь файл веб( Route::get('/', [\App\Http\Controllers\MainPageController::class, 'index']); Route::resource('moreinstitution','\App\Http\Controllers\MoreInsttitutionController'); //Route::resource('search','\App\Http\Controllers\MainPageController'); Route::get('/search',[\App\Http\Controllers\MainPageController::class, 'search']); Route::get('/warning', [\App\Http\Controllers\Warning\WarningController::class, 'store']); //Route::get('/autocomplete-search', [\App\Http\Controllers\Admin\PersonalController::class, 'autocompleteSearch']); //Export data to word Route::get('/generate-docx', [\App\Http\Controllers\Admin\DocxController::class, 'generateDocx']); Auth::routes(); Route::get('/home', [App\Http\Controllers\HomeController::class, 'index'])->name('home'); //'\App\Http\Controllers\Admin\PersonalController' Route::middleware(['role:admin'])->prefix('admin_panel')->group(function () { Route::get('/',[App\Http\Controllers\Admin\HomeController::class, 'index'])->name('homeAdmin'); Route::resource('category', \App\Http\Controllers\Admin\CategoryController::class); Route::resource('post',\App\Http\Controllers\Admin\PostController::class); Route::resource('position', \App\Http\Controllers\Admin\PositionController::class); Route::resource('institution', \App\Http\Controllers\Admin\InstitutionController::class); Route::resource('personal', \App\Http\Controllers\Admin\PersonalController::class); Route::resource('type', \App\Http\Controllers\Admin\TypeController::class); Route::resource('warning', \App\Http\Controllers\Warning\WarningController::class); Route::resource('autocomplete-search',\App\Http\Controllers\Admin\PersonalController::class); }); ) В PersonalController есть метод public function autocompleteSearch(Request $request) { $query = $request->search; if($query == null){ $personals = Personal:rderBy('created_at', 'desc')->paginate(10); }else{ $personals = Personal::where('surname', 'LIKE', "%{$query}%")->get(); } return view('admin.personal.index',[ 'personals' => $personals ]); } Но что-то выдает ошибку В чем может быть проблема?
код пожалуйста размести в тегах для код, читать невозможно --- Добавлено --- ну и судя по всему... PHP: //Route::get('/autocomplete-search', [\App\Http\Controllers\Admin\PersonalController::class, 'autocompleteSearch']); надо расскоментировать а PHP: Route::resource('autocomplete-search',\App\Http\Controllers\Admin\PersonalController::class); закомментировать а потом почитать что такое роуты и с чем их едят. и что такое ресурсы в роутах
PHP: <?php use Illuminate\Support\Facades\Route; /* |-------------------------------------------------------------------------- | Web Routes |-------------------------------------------------------------------------- | | Here is where you can register web routes for your application. These | routes are loaded by the RouteServiceProvider within a group which | contains the "web" middleware group. Now create something great! | */ Route::get('/', [\App\Http\Controllers\MainPageController::class, 'index']); Route::resource('moreinstitution','\App\Http\Controllers\MoreInsttitutionController'); //Route::resource('search','\App\Http\Controllers\MainPageController'); Route::get('/search',[\App\Http\Controllers\MainPageController::class, 'search']); Route::get('/warning', [\App\Http\Controllers\Warning\WarningController::class, 'store']); Route::get('/autocomplete-search', [\App\Http\Controllers\Admin\PersonalController::class, 'autocompleteSearch']); //Export data to word Route::get('/generate-docx', [\App\Http\Controllers\Admin\DocxController::class, 'generateDocx']); Auth::routes(); Route::get('/home', [App\Http\Controllers\HomeController::class, 'index'])->name('home'); //'\App\Http\Controllers\Admin\PersonalController' Route::middleware(['role:admin'])->prefix('admin_panel')->group(function () { Route::get('/',[App\Http\Controllers\Admin\HomeController::class, 'index'])->name('homeAdmin'); Route::resource('category', \App\Http\Controllers\Admin\CategoryController::class); Route::resource('post',\App\Http\Controllers\Admin\PostController::class); Route::resource('position', \App\Http\Controllers\Admin\PositionController::class); Route::resource('institution', \App\Http\Controllers\Admin\InstitutionController::class); Route::resource('personal', \App\Http\Controllers\Admin\PersonalController::class); Route::resource('type', \App\Http\Controllers\Admin\TypeController::class); Route::resource('warning', \App\Http\Controllers\Warning\WarningController::class); // Route::resource('autocomplete-search',\App\Http\Controllers\Admin\PersonalController::class); }); --- Добавлено --- <form method="get" action="{{ route('autocomplete-search.autocompleteSearch')}}">
<form method="get" action="{{route('autocompleteSearch')}}"> --- Добавлено --- --- Добавлено --- Я же почему и задал вопрос на форуме, перепробовал все