0

I have this project on Laravel 5.7 and Voyager on WAMP with 2 issues, the first one is when I run php artisan route:list and the result is:

 ReflectionException  : Class CustomerAccountController does not exist
 at C:\wamp64\www\cell_marketplace\vendor\laravel\framework\src\Illuminate\Container\Container.php:779

And actually the class exists and I'm using its functions on another processes and it's working, I've checked namespace, ran composer dump-autoload with no results.

The second one, I've created a BREAD on Voyager, and I got the model class and controller class, but when I go to the index of that resource again got this:

 ReflectionException: Class DropOffController does not exist in \vendor\laravel\framework\src\Illuminate\Container\Container.php:779

And the controller exists and has a function that it's actually working, so I think that's related with the first one but if anybody can help I'd really appreciate it

The CustomerAccountController class:

<?php

namespace App\Http\Controllers;

use App\Http\Controllers\Voyager\VoyagerBaseController;
use App\Models\CustomerAccount;
use App\Models\CustomerAccountTransaction;
use App\Models\Provider;
use Illuminate\Http\Request;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Session;
use Stripe\Charge;
use Stripe\Stripe;
use TCG\Voyager\Facades\Voyager;

class CustomerAccountController extends VoyagerBaseController
{
[...]
  • Check a few other things since the `composer dump-autoload` does not appear to be helping: class spelling, capitalization (case sensitivity depending on the OS), namespace usage (defined in the file and with the correct path), or file/folder permission(s) ... and maybe try a `php artisan config:clear` and `php artisan cache:clear` to see if any of these may help. If all that looks good, then try a lint check on your files to ensure there's no syntax error(s) with the classes `php -l file.php`. – Paul T. Jul 04 '22 at 21:51
  • Thanks for your answer!. I've already tried clear the config cache and app cache and nothing change, checked namespace, class spelling but I can't find any typo. Also if any error would be present on the class the rest of the methods wouldn't be able to be executed and they execute, any idea? – Carlos Mendez Jul 11 '22 at 23:44
  • Did you check `php -l` on the files? ... [another 5.7 user](https://stackoverflow.com/questions/53700413/class-does-not-exist-reflection-exception-error-in-laravel-5-7) had a missing `;` in one of the functions that caused that error. You could also try `php artisan route:clear`, but other than that append the class definitions to the question. – Paul T. Jul 12 '22 at 00:48
  • Yes I did, and I got `No syntax errors detected in CustomerAccountController.php` and `No syntax errors detected in DropOffController.php` and when I execute `route:clear` its actually clears the route cache, but the error is still there – Carlos Mendez Jul 14 '22 at 18:15

1 Answers1

0

I found the issue, it needed the absolute path to the controller, not the relative when configuring the BREAD for that resource, the project is in Laravel Voyager.