use illuminate\Foundation\Http\FormRequest;
use I // UPPERCASE I LETTER
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
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>
use illuminate\Foundation\Http\FormRequest;
use I // UPPERCASE I LETTER
Please or to participate in this conversation.