Laravel 5: DB Seed class not found

前端 未结 7 814
孤独总比滥情好
孤独总比滥情好 2021-02-03 21:15

I have this DatabaseSeeder.php:



        
7条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-03 22:08

    If the above solutions doesn't work, try this one. You may have changed the namespace (by default, it's "App"). What you need to do is to go to the composer.json file and check this:

    "autoload": {
          "classmap": [
              "database"
          ],
          "psr-4": {
              "App\\": "app/"
          }
      },
    

    If the namespace is App like this example, this solution is not for you.

    Otherwise, take the namespace you found and insert that line into your seeder class:

    use NameSpaceFound\User;
    

提交回复
热议问题