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

Q8Xbox's avatar
Level 1

using axios to delete user in Laravel through 500 error

I have a separate table for users which has all users included the roles like admin, user and referee. Now I would like to make another table to manage data related to volunteers data only everything looks fine but when try to delete specific volunteer data axios through 500

fe {message: 'Request failed with status code 500', name: 'AxiosError', code: 'ERR_BAD_RESPONSE', config: {…}, request: XMLHttpRequest, …}

not sure what cause of this error even in laravel.log says something like this:

[2024-07-24 22:05:35] development.ERROR: Class "App\Http\Controllers\File" not found {"userId":11,"exception":"[object] (Error(code: 0): Class \"App\Http\Controllers\File\" not found at D:\projectName\app\Http\Controllers\VolunteersController.php:201)
[stacktrace]
#0 D:\projectName\vendor\laravel\framework\src\Illuminate\Routing\Controller.php(54): App\Http\Controllers\VolunteersController->DeleteVolunteer('23')
#1 D:\projectName\vendor\laravel\framework\src\Illuminate\Routing\ControllerDispatcher.php(43): Illuminate\Routing\Controller->callAction('DeleteVolunteer', Array)
#2 D:\projectName\vendor\laravel\framework\src\Illuminate\Routing\Route.php(259): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(App\Http\Controllers\VolunteersController), 'DeleteVolunteer')
...

This is the code i'm using currently

https://codeshare.io/k0bKq3
0 likes
2 replies
martinbean's avatar
Level 80

@q8xbox Read the error message? It’s telling you exactly what the problem is, as well as the file and line number.

You’re referencing a File class, which doesn’t exist, in app\Http\Controllers\VolunteersController.php on line 201. So you’ve probably forgot to import it.

Learn to read error messages. They‘re seldom wrong, and usually tell you exactly what the problem is, and where it is, like it has done in this instance.

Q8Xbox's avatar
Level 1

@martinbean I did not thought of keyword File in the code when i saw log file the first thing i look into it is userId :( so i need to get more knowledge about log files details carefully in future.

Please or to participate in this conversation.