Laravel 10: Target class [AppHttpControllersappdashboarddashboardController] does not exist

I tried logging in a user (email and password) to the user’s dashboard page but got the error message:
Target class [AppHttpControllersappdashboarddashboardController] does not exist, after clicking the login button.

My expectations:
After a user has logged in and is authenticated the user is to be redirected to the dashboard page.
But instead I get this error:
Target class [AppHttpControllersappdashboarddashboardController] does not exist.
Look at the full description of what I’ve done:
I’ve written this code:

<x-layout.guest-layout>
        <form action="{{route('login.func')}}" method="post">

        @csrf

        <main class="flex flex-col justify-center items-center gap-3 py-4">

            <div>
                <h4>Login</h4>
            </div>

            @if (Session('success'))
                <p class="text-green-500 font-bold p-2 flex flex-row justify-center item-center">
                    {{Session('success')}}
                </p>
            @endif
            
            @if (Session('error'))
                <p class="text-red-500 font-bold p-2 flex flex-row justify-center item-center">
                    {{Session('error')}}
                </p>
            @endif
            
            @if (Session('exist'))
                <p class="text-gray40 font-bold p-2 flex flex-row justify-center item-center">
                    {{Session('exist')}}
                </p>
            @endif

            <div class="flex flex-col justify-start w-1/2">
                <label for="email">Email</label>
                <input class="rounded-md p-1 border focus:outline-green-500" type="email" name="email" id="email">

                {{-- error directives --}}
                @error('email')
                    <div class="font-semibold text-red-500 text-sm">
                        {{$message}}
                    </div>
                @enderror
                
            </div>
            
            <div class="flex flex-col justify-start w-1/2">
                <label for="password">Password</label>
                <input class="rounded-md p-1 border focus:outline-green-500" type="password" name="password" id="password">

                @error('password')
                    <div class="font-semibold text-red-500 text-sm">
                        {{$message}}
                    </div>
                @enderror
            </div>

            <div class="flex flex-col gap-2 w-1/2">
                <button class="text-white bg-green-500 font-bold rounded-md p-1">Login</button>
                <a href="/register" class="text-green-400 font-semibold">Create an Account</a>
            </div>
            
        </main>
    </form>
</x-layout.guest-layout>

within this file below:
Login page file location
that allows users to login, sending their credentials to be authenticated, into the file below:
Location of authentication controller file
which gets handled by the loginFunc method below:

<?php

namespace AppHttpControllersappauth;

use AppHttpControllersController;
use AppModelsUserModel;
use AppHttpControllersappdashboarddashController;
use IlluminateHttpRequest;
use IlluminateValidationValidationException;
use IlluminateSupportFacadesHash;
use IlluminateSupportFacadesSession;

class authController extends Controller
{
    public function loginPage(){
        if (Session::get('userID')) {
            return redirect('/dashboard');
        }
        
        return view("app.pages.auth.loginPage");
 
    }

    public function registerPage(){
        if (Session::get('userID')) {
            return redirect('/dashboard');
        }
        return view("app.pages.auth.registerPage");
    }

    // public function dashboardPage(){
    //     if (!Session::get('userID')) {
    //         return Back()->with('', 'Access Denied');
    //     }
    //     return view('app.pages.dashboard.protectedDashPage');
    // }

    public function loginFunc(Request $request)
    {
        try {
            $request->validate([
                'email' => ['required', 'email'],
                'password' => ['required', 'string', 'min:8', 'max:15']
            ]);

            $existingUser = UserModel::where('email', $request->email)->first();

            if (!$existingUser /**$exitingUser->password !== $request->password*/) {
                return redirect('/')->with('exist', 'User does not exist');
            }elseif(!Hash::check($request->password, $existingUser->password)){
                return redirect('/')->with('error', 'Invalid email or password');
            }

            $request->session()->start();
            $request->session()->put('userID', $existingUser->id);
            return redirect('/dashboard');

        } catch (ValidationException $e) {
            return back()->withErrors($e->validator->errors());
        }//;
    }

using this route:

// Route to controller that processes form's input
Route::post('/login', [authController::class, 'loginFunc'])->name('login.func');

The loginFun authenticates the user, and if the user is authenticated, redirects the user to the dashboard page file:
location of dasboard bage file
Using the the last route in the code below:

<?php

use AppHttpControllersappauthauthController;
use AppHttpControllersappdashboarddashController;
use IlluminateSupportFacadesRoute;



// Route to pages
Route::get('/', [authController::class, 'loginPage'])->name('index.page');
Route::get('/register', [authController::class, 'registerPage'])->name('register.page');
Route::get('/about', [dashController::class, 'aboutPage'])->name('about.page');


Route::middleware('authM')->group(function () {
    Route::get('/dashboard',[dashController::class, 'dashboardPage'])->name('dashboard.page');
});

route to dashboard page file
This route points to two files. First the authM middleware file below:
Location of authM middleware file
Having the code below:

<?php

namespace AppHttpMiddleware;


use Closure;
use IlluminateHttpRequest;
use SymfonyComponentHttpFoundationResponse;
use IlluminateSupportFacadesSession;

class authM
{
    /**
     * Handle an incoming request.
     *
     * @param  Closure(IlluminateHttpRequest): (SymfonyComponentHttpFoundationResponse)  $next
     */
    public function handle(Request $request, Closure $next): Response
    {
        if (!Session::get("userID")) {
            return redirect('/')->with('error', 'Please Login');
        }
        return $next($request);
    }
}

That prevents any unauthorise ascess to the dashboard page, and the dashController contoller file below:
Loction of the dashboard controller file
That contains the dashboardPage method below:

<?php

namespace AppHttpControllersappdashboard;

use AppHttpControllersController;
use IlluminateHttpRequest;
use IlluminateSupportFacadesSession;

class dashController extends Controller
{
    public function aboutPage()
    {
        return view('app.pages.dashboard.about');
    }
    
    public function dashboardPage(){
        return view('app.pages.dashboard.protectedDashPage');
    }
}

Which renders the dashboard page (protectedDashPage.blade.php).
But I just keep getting the error:
Target class [AppHttpControllersappdashboarddashboardController] does not exist.
error message

New contributor

Worldlight Idakpo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật