I am refactoring my code and getting 404 Page not found error in one route. I tried every possible solution but no luck. My route is give below:
Route::prefix('admin')->group(function () {
.... other routes
Route::prefix('product')->group(function () {
.... other routes
Route::prefix('category')->group(function () {
Route::get('/', function () {
dd('check');
});
<!-- Route::get('/', 'ProductCategoryController@index')->name('product_category_index'); -->
.... other routes
});
});
});
In debugbar I am getting the exception:
No query results for model [App\Product] category F:\bvend\bvend.web\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Builder.php#389 Illuminate\Database\Eloquent\ModelNotFoundException
I have no longer App\Category model in my code. Instead I have App\ProductCategory
I have no clue what the mistake is. Please help.
admin/product/{product}
? Looks like a route conflict to me, maybe try placingRoute::prefix('category')
directly afterRoute::prefix('product')
– Remulcomposer dump-autoload
hope the problem will gone – sta