LoginSignup
0
0

More than 3 years have passed since last update.

Laravelでseederをsubdirectoryに設置したい時

Posted at

Laravel 5.8

Seederの中でディレクトリを切りたい時。単にディレクトリを切るだけだとダメ。
composer.jsonのclassmapに追加する。

composer.json
"autoload": {
    "classmap": [
        "app/commands",
        "app/controllers",
        "app/models",
        "app/database/migrations",
        "app/database/seeds",
        "app/tests/TestCase.php",
        "app/database/seeds/SubDirectory"  // <-- 追加
    ]
}

ついかしたら下記を実行

composer dump-autoload

参考
https://stackoverflow.com/questions/23919825/call-database-seeder-from-a-subfolder

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0