ReflectionException: Class ClassName does not exist - Laravel

后端 未结 22 1186
无人共我
无人共我 2020-11-29 04:39

As soon, I am typing php artisan db:seed command.

I\'m getting Error Like:

[ReflectionException]
Clas

相关标签:
22条回答
  • 2020-11-29 04:43

    Not strictly related to the question but received the error ReflectionException: Class config does not exist

    I had added a new .env variable with spaces in it. Running php artisan config:clear told me that any .env variable with spaces in it should be surrounded by "s.

    Did this and my application stated working again, no need for config clear as still in development on Laravel Homestead (5.4)

    0 讨论(0)
  • 2020-11-29 04:47
    composer update 
    

    Above command worked for me.

    Whenever you make new migration in la-ravel you need to refresh classmap in composer.json file .

    0 讨论(0)
  • 2020-11-29 04:51

    For some reason I had to run composer dumpautoload -o. Notice flag -o which mean with optimization. I don't have any idea why it works only with it but give it a try. Perhaps it helps someone.

    0 讨论(0)
  • 2020-11-29 04:52
    composer dump-autoload
    php artisan config:clear
    php artisan cache:clear
    

    This will surely work. If not then, you need to do

    composer update
    

    and then, the aforementioned commands.

    0 讨论(0)
  • 2020-11-29 04:53
    composer dump-autoload 
    

    this will fix it

    0 讨论(0)
  • 2020-11-29 04:54

    Usually error message ReflectionException: Class app does not exist appears in larval test when you forget to close connection.

    if you're using setUp or tearDown function in your test do not forget to close connection by calling parent::setUp and parent::tearDown

        public function setUp()
        {
            parent::setUp();
        }
    
        public function tearDown()
        {
            parent::tearDown();
        }
    
    0 讨论(0)
提交回复
热议问题