1
votes

Every one. Nice to meet you.
My code is below.

-controller.php

public function admin(Request $request) {
   if ($request->ajax()) {
     $users = \DB::table('users')->leftJoin('roles', 'users.role_id', '=', 'roles.id')->select('users.id as id', 'roles.name as role_name', 'users.*')->get();
...
   return Datatables::of(results)->make();
}
   return view('frontend.homepage.admin');

-web.php

Route::prefix("admin")->middleware(["auth:admin"])->group(function(){
    Route::get('dashboard', ['as' => 'homepage.admin', 'uses' => 'PagesController@admin']);    
});


But I have one error like as below.

{ "message": "", "exception": "Symfony\Component\HttpKernel\Exception\NotFoundHttpException", "file": "E:\Uniclix_Source\API\vendor\laravel\framework\src\Illuminate\Routing\RouteCollection.php", "line": 179, "trace": [ { "file": "E:\Uniclix_Source\API\vendor\laravel\framework\src\Illuminate\Routing\Router.php", "line": 636, "function": "match", "class": "Illuminate\Routing\RouteCollection", "type": "->" }, { "file": "E:\Uniclix_Source\API\vendor\laravel\framework\src\Illuminate\Routing\Router.php", "line": 625, "function": "findRoute", "class": "Illuminate\Routing\Router", "type": "->" }, { "file": "E:\Uniclix_Source\API\vendor\laravel\framework\src\Illuminate\Routing\Router.php", "line": 614, "function": "dispatchToRoute", "class": "Illuminate\Routing\Router", "type": "->" }, { "file": "E:\Uniclix_Source\API\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php", "line": 176, "function": "dispatch", "class": "Illuminate\Routing\Router", "type": "->" }, { "file": "E:\Uniclix_Source\API\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php", "line": 30, "function": "Illuminate\Foundation\Http\{closure}", "class": "Illuminate\Foundation\Http\Kernel", "type": "->" }

Who can help me?

2
What is the route you're trying to use to access the page?aynber
Yes, why I have the error?user12586173
That wasn't a yes-or-no question. I was asking, what is the route that you're using to access the page? From the looks of it, your URL should have /admin/dashboard. You can verify all of your routes by doing php artisan routes:list to see all of your registered routes.aynber

2 Answers

0
votes

That's because of the url setting issue. Perhaps the error code would be "404". Please check the api endpoint.

0
votes

NotFoundHttpException raises when specified route does not exist.

According to your code, your route is /admin/dashboard.