samedi 28 novembre 2020

Target class [Admin\AdminController] does not exist

I'm developing a website using Laravel 8 by watching youtube tutorial, and I encounter an error message and don't know how to solve it. I tried to change the namespace but it didn't work. ERROR MESSAGE PICT

My AdminController.php code

<?php 

namespace App\Http\Controllers\Admin;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;

class AdminController extends Controller
{
   public function dashboard(){
       return view('admin.admin_dashboard');
   }
}

And my web.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('/', function () {
   return view('welcome');
});

Auth::routes();

Route::get('/home', [App\Http\Controllers\HomeController::class, 'index'])->name('home');

Route::prefix('/admin')-> namespace ('Admin')-> group (function(){
   //All the admin roles will be defined here
   Route::get('dashboard','AdminController@dashboard');
});

can anyone help me to solve this? thanks.




Aucun commentaire:

Enregistrer un commentaire