I have a form that looks like:
enctype="multipart/form-data">
@csrf
...
And there is a button that triggers the function and it's:
function addLesson(id) {
const form = document.getElementById('addLessonForm');
form.action = `/units/${id}/lessons/`;
SideSection("Adding New Lesson", null, 'addLessonForm');
}
I get a 405 error message saying method not allowed even though i have similar behavior and functions for units, courses and categories, they work just as fine but it's lessons that causes the issue and it's only happening locally, i have it hosted on AWS LightSail
The routes are:
Route::get('/units', [UnitController::class, 'index'])->name('unit.index');
Route::post('/courses/{id}/units', [UnitController::class, 'store'])->name('unit.store');
Route::get('/courses/{id}/units', [UnitController::class, 'get'])->name('unit.get');
Route::get('/courses/{id}/units/{unitId}', [UnitController::class, 'show'])->name('unit.show');
Route::put('/courses/{id}/units/{unitId}', [UnitController::class, 'update'])->name('unit.update');
Route::delete('/courses/{id}/units/{unitId}', [UnitController::class, 'destroy'])->name('unit.destroy');
Route::post('/units/{id}/lessons', [LessonController::class, 'store'])->name('lesson.store');
Route::get('/units/{unitId}/lessons/{lessonId}', [LessonController::class, 'show'])->name('lesson.show');
Route::put('/units/{unitId}/lessons/{lessonId}', [LessonController::class, 'update'])->name('lesson.update');
Route::delete('/units/{unitId}/lessons/{lessonId}', [LessonController::class, 'destroy'])->name('lesson.destroy');
Route::get('/lessons', [LessonController::class, 'index'])->name('lesson.index');