Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

ComputerMaverick's avatar

"Class 'illuminate\Foundation\Http\FormRequest' not found"

I'm getting a "Class 'illuminate\Foundation\Http\FormRequest' not found" even when it is properly called on my

Error Message

responseJSON:
exception: "Error"
file: "/Applications/XAMPP/xamppfiles/htdocs/EduAfrique/app/Http/Requests/StoreCourseRequest.php"
line: 8
message: "Class 'illuminate\Foundation\Http\FormRequest' not found"

StoreCourseRequest.php

<?php
namespace App\Http\Requests;

use Illuminate\Support\Facades\Gate;
use illuminate\Foundation\Http\FormRequest;
use Symfony\Component\HttpFoundation\Response;

class StoreCourseRequest extends FormRequest {
    public function authorize(){
        abort_if(Gate::denies('course_create'), Response::HTTP_FORBIDDEN, '403 Forbidden');

        return true;
    }

    public function rules(){
        return [
            'course_title' => [
                'required',
                'unique:courses',
            ],
            'short_description' => [
                'required',
                'max:255',
            ],
            'outcomes.*' =>[
                'integer',
            ],
            'outcomes' => [
                'array',
            ],
            'language' => [
                'required',
            ],
            'sub_category_id' => [
                'integer',
                'required',
            ],
            'requirements.*' => [
                'integer',
            ],
            'requirements' => [
                'array',
            ],
            'course_thumbnail' => [
                'required',
            ],
        ];
    }
}

Here is the Ajax call code.

<script type="text/javascript">
    var quill = new Quill('#course_description', {
        theme: 'snow',
    });
    var description = quill.getContents();
    var course_description = description.opts;

    $('#wizard1').steps({
		headerTag: 'h3',
		bodyTag: 'section',
		autoFocus: true,
		titleTemplate: '<span class="number">#index#<\/span> <span class="title">#title#<\/span>',
        onFinishing: function (event, currentIndex){
            
            $.ajax({
                type : 'POST',
                url  : "{{route('courses.store')}}",
                headers: {
                    'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                },
                data:{
                    'course_title':$('#course_title').val(),
                    'shor_description':$('#short_description').val(),
                    'course_description': course_description,
                    'sub_category_id':$('#sub_category_id').val(),
                    'level':$('#level').val(),
                    'language_made_in':$('#language_made_in').val(),
                    'is_top_course':$('#is_top_course').val(),
                    'requirements':$('#requirements').val(),
                    'outcomes':$('#outcomes').val(),
                    'course_overview_provider':$('#course_overview_provider').val(),
                    'course_overview_url':$('#course_overview_url').val(),
                    'course_thumbnail':$('#course_thumbnail').val(),
                    'meta_keywords':$('#meta_keywords').val(),
                    'meta_description':$('#meta_description').val(),
                    'is_free_course':$('#is_free_course').val(),
                    'price':$('#price').val(),
                    'discount_flag':$('#discount_flag').val(),
                    'discounted_price':$('#discounted_price').val(),
                },
                success:function(response){
                    if(response.success){
                        swal({
                            title: response.message,                                
                            type: "success"
                            }, function() {
                                location.href = "{{route('courses.index')}}";
                        });
                    } 
                },
                error:function(error){
                    swal({
                        title: "An Error Occured",
                        text: "Please Check Data and Try again.",
                        type: "error"
                        }, function() {
                            location.reload();
                    });
                    console.log(error)
                } 
            });
            event.preventDefault();
        }
});
</script>
0 likes
8 replies
Sergiu17's avatar
Sergiu17
Best Answer
Level 60
use illuminate\Foundation\Http\FormRequest;
use I // UPPERCASE I LETTER
Sinnbeck's avatar

Uppercase i in illuminate

use Illuminate\Foundation\Http\FormRequest;
tykus's avatar

Capital i!

use Illuminate\Foundation\Http\FormRequest;
Sinnbeck's avatar

@michaloravec ok? Care to elaborate? I would expect 19 to come before 20, but maybe I am missing something. And just pointing out a possible logic flaw in the comment logic :)

MichalOravec's avatar

@sinnbeck 20 minutes it means that it is older than your and tykus post. So it should be the first post.

Please or to participate in this conversation.