Class “AppHttpRequestScholarshipRequest” does not exist

I made a middleware where the users are not able to publish scholarships if the user doesn’t register as provider. It was working earlier but now it was throwing error after adding policy and soft deletes to the system. I am wondering where did I go wrong from my part.

Middleware/Scholarprovider.php

<?php



namespace AppHttpMiddleware;



use Closure;

use IlluminateHttpRequest;

use SymfonyComponentHttpFoundationResponse;



class Scholarprovider

{

    /**

     * Handle an incoming request.

     *

     * @param  Closure(IlluminateHttpRequest): (SymfonyComponentHttpFoundationResponse)  $next

     */

    public function handle(Request $request, Closure $next): Response

    {

        if (null === $request->user() || null === $request->user()->scholarprovider) {

            return redirect()->route('scholarprovider.create')

                ->with('error', 'You need to register for Scholarprovider first!');

        }



        return $next($request);



    }

}

Scholarrequest.php

<?php

namespace AppHttpRequests;

use IlluminateFoundationHttpFormRequest;
use AppModelsScholarship;

class ScholarshipRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     */
    public function authorize(): bool
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array<string, IlluminateContractsValidationValidationRule|array<mixed>|string>
     */
    public function rules(): array
    {
        return [
            
            
                'title' => 'required|string|max:225',
                'description' => 'required|string|max:225',
                'schoolname' => 'required|string|max:225',
                'requirements' => 'required|string|max:225',
                'location' => 'required|string|max:225',
                'contactno' => 'required|string|max:225',
                'category' => 'required|in:' . implode(',', Scholarship::$category),
                'grants' => 'required|in:' . implode(',', Scholarship::$grants),
                'grade_needed' => 'required|numeric|max:100',
                'monetary_value' => 'required|numeric|min:1000',
    
            
        ];
    }
}



ScholarshipPolicy.php

<?php

namespace AppPolicies;

use AppModelsScholarship;
use AppModelsUser;
use IlluminateAuthAccessResponse;

class ScholarshipPolicy
{
    /**
     * Determine whether the user can view any models.
     */
    public function viewAny(?User $user): bool
    {
        return true;
    }

    public function viewAnyScholarprovider(User $user): bool
    {
        return true;
    }

    /**
     * Determine whether the user can view the model.
     */
    public function view(?User $user, Scholarship $scholarship): bool
    {
        return true;
    }

    /**
     * Determine whether the user can create models.
     */
    public function create(User $user): bool
    {
        return $user->scholarprovider !== null;
    }

    /**
     * Determine whether the user can update the model.
     */
    public function update(User $user, Scholarship $scholarship): bool | Response
    {
        if ($scholarship->scholarprovider->user_id !== $user->id) {
            return false;
        }

        if ($scholarship->scholarshipApplications()->count() > 0) {
            return Response::deny('Cannot change the Scholarship with applications');
        }
        return true;
    }

    /**
     * Determine whether the user can delete the model.
     */
    public function delete(User $user, Scholarship $scholarship): bool
    {
        return false;
    }

    /**
     * Determine whether the user can restore the model.
     */
    public function restore(User $user, Scholarship $scholarship): bool
    {
        return false; //
    }

    /**
     * Determine whether the user can permanently delete the model.
     */
    public function forceDelete(User $user, Scholarship $scholarship): bool
    {
        return false;
    }

    public function apply(User $user, Scholarship $scholarship): bool
    {
        return !$scholarship->hasUserApplied($user);
    }

}

MyScholarshipController.php (where I added soft delete)

<?php

namespace AppHttpControllers;

use AppModelsScholarshipApplication;
use IlluminateHttpRequest;

class MyScholarshipApplicationController extends Controller
{
    /**
     * Display a listing of the resource.
     */
    public function index()
    {

        return view('my_scholarship_application.index',
        [
            'applications' => auth()->user()->scholarshipApplications()
                ->with([
                    'scholarship' => function ($query) {
                        $query->withCount('scholarshipApplications')
                              ->withTrashed();
                    },
                    'scholarship.scholarprovider'
                ])
                ->latest()
                ->get()
        ]
    );
    }

   

    public function destroy(ScholarshipApplication $myScholarshipApplication)
    {


        $myScholarshipApplication->delete();

        return redirect()->back()->with(
            'success',
            'Scholarship Application Removed.'
        );
    }
}

What I tried so far is to link ScholarshipRequest to Middleware but it seems laravel couldn’t find the Controller resulting for it being unable to create new Scholarships.

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