ReflectionException: Class ClassName does not exist - Laravel

后端 未结 22 1189
无人共我
无人共我 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 05:01

    From my experience, this will show up most of the time when the class you are trying to call has some bugs and cannot be compiled. Check if the class that is not being reflected can be executed at its own.

    0 讨论(0)
  • 2020-11-29 05:02

    You need to assign it to a name space for it to be found.

    namespace App\Http\Controllers;
    
    0 讨论(0)
  • 2020-11-29 05:04

    try to use following command

    php artisan db:seed --class=DatabaseSeeder
    
    0 讨论(0)
  • 2020-11-29 05:05

    A composer dump-autoload should fix it.

    0 讨论(0)
  • 2020-11-29 05:05

    Check your capitalization!

    Your host system (Windows or Mac) is case insensitive by default, and Homestead inherits this behavior. Your production server on the other hand is case sensitive.

    Whenever you get a ClassNotFound Exception check the following:

    1. Spelling
    2. Namespaces
    3. Capitalization
    0 讨论(0)
  • 2020-11-29 05:06

    If the issue is not resolved by composer dump-autoload or is not a newly created class.

    Check for syntax errors in your class and its traits as well. In my case, there was a syntax error in a Trait, but ReflectionException was shown for the actual Class using that Trait instead.

    0 讨论(0)
提交回复
热议问题