Class AppHttpControllersUserController Does Not Exist



PHP Snippet 1:

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

PHP Snippet 2:

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

PHP Snippet 3:

use App\Http\Controllers\PagesController;

PHP Snippet 4:

Route::group(['middleware' => 'isAdmin'], function(){
    Route::get('/admin', 'AdminController@index');

    Route::get('/users', 'UserController@index');
    Route::get('/user/add', 'UserController@getAdd');
    Route::post('/user/add', 'UserController@postAdd');
    Route::get('/user/edit/{id}', 'UserController@getEdit');
    Route::post('/user/edit/{id}', 'UserController@postEdit');
    Route::get('/user/delete/{id}', 'UserController@delete');
});

PHP Snippet 5:

Route::group(['middleware' => 'isAdmin'], function(){
    Route::get('/admin', 'AdminController@index');
    Route::group(['namespace' => YOUR_NAMESPACE], function(){
        Route::get('/users', 'UserController@index');
        Route::get('/user/add', 'UserController@getAdd');
        Route::post('/user/add', 'UserController@postAdd');
        Route::get('/user/edit/{id}', 'UserController@getEdit');
        Route::post('/user/edit/{id}', 'UserController@postEdit');
        Route::get('/user/delete/{id}', 'UserController@delete');
    });
});

PHP Snippet 6:

<?php

namespace App\Controllers;

use App\Http\Requests;
use App\User;
use App\UserTypes;

use Auth;
use Hashids;
use Redirect;
use Request;
use Hash;

class UserController extends Controller
{
    public function index(){
        $users = User::get();
        return view('users.index', compact('users'));
    }

    public function getAdd(){
        $user_type = UserTypes::pluck('user_type', 'id');
        return view('users.add', compact('user_type'));
    }

    public function postAdd(){
        $input = Request::all();
        $password = str_random(8);
        User::create(
            'email' => $input['email'],
            'password' => Hash::make($password),
            'first_name' => $input['first_name'],
            'surname' => $input['surname'],
            'phone_number' => $input['phone_number'],
            'user_type' => $input['user_type'],
        );

        return Redirect::action('UserController@index');
    }

    public function getEdit($id){

    }

    public function postEdit($id){

    }

    public function delete($id){
        User::find(current(Hashids::decode($id)))->delete();
        return Redirect::action('UserController@index');
    }

}

PHP Snippet 7:

Route::group(['middleware' => 'auth'], function(){
    Route::get('/route/selector', 'PagesController@selectRoute');

    // Admin Only //
    Route::group(['middleware' => 'isAdmin'], function(){
        Route::get('/admin', 'AdminController@index');
        Route::group(['namespace' => '\App\Controllers'], function(){
            Route::get('/users', 'UserController@index');
            Route::get('/user/add', 'UserController@getAdd');
            Route::post('/user/add', 'UserController@postAdd');
            Route::get('/user/edit/{id}', 'UserController@getEdit');
            Route::post('/user/edit/{id}', 'UserController@postEdit');
            Route::get('/user/delete/{id}', 'UserController@delete');
        });
    });
});

PHP Snippet 8:

User::create([
    'email' => $input['email'],
    'password' => Hash::make($password),
    'first_name' => $input['first_name'],
    'surname' => $input['surname'],
    'phone_number' => $input['phone_number'],
    'user_type' => $input['user_type'],
]);

PHP Snippet 9:

use App\Http\Controllers\UserController;

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

PHP Snippet 10:

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

PHP Snippet 11:

use App\Http\Controllers\UserController;

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

PHP Snippet 12:

use App\Http\Controllers\Controller;

PHP Snippet 13:

use App\Http\Controllers\Controller;

PHP Snippet 14:

php artisan make:controller UserController

PHP Snippet 15:

$user = User::create([
    'email' => $input['email'],
    'password' => Hash::make($password),
    'first_name' => $input['first_name'],
    'surname' => $input['surname'],
    'phone_number' => $input['phone_number'],
    'user_type' => $input['user_type'],
]);

PHP Snippet 16:

Route::get('/', 'api\AppController@appInfo');

PHP Snippet 17:

protected $namespace = 'App\Http\Controllers';

PHP Snippet 18:

$this->configureRateLimiting();

$this->routes(function () {
    Route::middleware('api')
        ->prefix('api')
        ->group(base_path('routes/api.php'));
    Route::namespace($this->namespace)
        ->middleware('web')
        ->group(base_path('routes/web.php'));
    Route::namespace($this->namespace)
        ->middleware('web')
        ->group(base_path('routes/dashboard.php'));
})