0
Personal I am developing a Rest api using Windows and to create this api I am using the tutorial:
- https://rafaell-lycan.com/2015/construindo-restful-api-laravel-parte-1/
- https://rafaell-lycan.com/2015/construindo-restful-api-laravel-parte-2/
- https://rafaell-lycan.com/2015/construindo-restful-api-laravel-parte-3/
when turning the control:
php artisan route:list
I am presented with the following error:
ReflectionException:Class App\Http\Controllers\pagesController does not exist
at /var/www/html/freelance/HQ Alma/api/vendor/laravel/framework/src/Illuminate/Container/Container.php:7
79
775| if ($concrete instanceof Closure) {
776| return $concrete($this, $this->getLastParameterOverride());
777|}
778|
779|$reflector = new ReflectionClass($concrete);
780|
781|// If the type is not instantiable, the developer is attempting to resolve
782|// an abstract type such as an Interface of Abstract Class and there is
783|// no binding registered for the abstractions so we need to bail out.
Exception trace:
1 ReflectionClass::__construct("App\Http\Controllers\pagesController")
/var/www/html/freelance/HQ Alma/api/vendor/laravel/framework/src/Illuminate/Container/Container.php:779
2 Illuminate\Container\Container::build("App\Http\Controllers\pagesController")
/var/www/html/freelance/HQ Alma/api/vendor/laravel/framework/src/Illuminate/Container/Container.php:658
Please use the argument -v to see more details.
These are my routes:
Route::group(array('prefix' => 'hqi'), function()
{
Route::get('/', function () {
return response()->json(['message' => 'HQI API', 'status' =>
'Connected']);;
});
Route::resource('users', 'UserController');
Route::resource('pages', 'PagesController');
Route::resource('palestra', 'PalestrasDivulgacaoController');
});
Route::get('/', function () {
return redirect('api');
});
Someone would know what it could be?
Apparently Laravel isn’t finding the class
PagesController
. Check the name, location of the file and if thecomposer.json
is correctly configured, don’t forget to give adump-autoload
afterward– Costamilam
Pagescontroller is the controller that I created it doesn’t have to be set in Composer
– Thayller vilela cintra
I started from scratch and was testing, and somehow the Variable did not recognize that the controller created existed, after remaking it correctly accepted
– Thayller vilela cintra
What was pointed out in the error is that the controller was not found. Initially I deleted the controller and created again and it didn’t work, so I created a new api and tested the process
– Thayller vilela cintra
You can try to execute the command
composer dump-autoload
and see if Laravel recognizes his route.– Hermes Autran