0

since a composer update I got this error when I run php artisan route:list :

[Symfony\Component\Debug\Exception\FatalThrowableError] Class name must be a valid object or a string

I ran some tests and this is the lines where the error should but i don't see why:

    use Businessbecause\Users\Controllers\Users;
    Route::get('/users/update/created_at', Users::class .'@update_users_created_at');

Do you have any idea why it's not working anymore ? Cause it's the same code than before nothing has changed.

Amaury Leproux
  • 229
  • 1
  • 5
  • 21

1 Answers1

2

Try this

Route::get('/users/update/created_at','Businessbecause\Users\Controllers\Users@update_users_created_at');

Users::class .' like this it won't work i guess (not sure).


Or pass as array in second param
ref link https://laravel.com/docs/8.x/routing#basic-routing

use Businessbecause\Users\Controllers\Users;
Route::get('/users/update/created_at', [Users::class ,'update_users_created_at']);
Kamlesh Paul
  • 11,778
  • 2
  • 20
  • 33
  • Thanks, it did work for one route file and for the other I use the same method [Users::class] but I get "[Symfony\Component\Debug\Exception\FatalThrowableError] Call to undefined method Symfony\Component\Console\Helper\QuestionHelper::getInputStream()" – Amaury Leproux Oct 01 '20 at 08:59
  • I managed to fix the route file issue but the main issue still remain, I can't access any routes on my browser. I always get this non clear message: Undefined Exception Symfony\Component\HttpKernel\Exception\NotFoundHttpException – Amaury Leproux Oct 01 '20 at 09:30
  • @AmauryLeproux take a look into this https://stackoverflow.com/questions/23593892/symfony-component-httpkernel-exception-notfoundhttpexception-laravel – Kamlesh Paul Oct 01 '20 at 09:57