Home > other >  whats wrong in it cause error is Target class [Admin\App\Http\Controllers\Admin\UserController]
whats wrong in it cause error is Target class [Admin\App\Http\Controllers\Admin\UserController]

Time:09-30

Route::resource('admin/user', App\Http\Controllers\Admin\UserController::class);

whats wrong in it cause error is Target class [Admin\App\Http\Controllers\Admin\UserController] does not exist.

CodePudding user response:

Latest version of Laravel introduce us a different way to write route

In old version it was

Route::get('/', 'UserController@index');

In Latest version

use App\Http\Controllers\UserController; //namespace

Route::get('/',[UserController::class, 'index']);

CodePudding user response:

Route::resource('admin/user', Admin\UserController::class);

  • Related