1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Target class [Database\Seeders\class=HogeTableSeeder] does not exist.

Last updated at Posted at 2022-03-09

Laravelのseederを使用中、初歩的なミスでちょっと??となったので記録。

ローカルで動くことを確認しているシーダーをデプロイ中のこと。

composer dump-autoload
php artisan optimize
php artisan db:seed class=SettingTableSeeder

を実行すると、

   Illuminate\Contracts\Container\BindingResolutionException

  Target class [Database\Seeders\class=SettingTableSeeder] does not exist.

と出たのでおかしいなあ、クラス名のタイプミス・・・でもないなあ。
今 pull したソース namespace入ってるかなあ。

namespace Database\Hoge;

あるなあ・・・

結論。
artisanコマンドミスってた。

間違い php artisan db:seed class=SettingTableSeeder
正しい  php artisan db:seed --class=SettingTableSeeder

-- が抜けていますが、こんな構文ミスみたいなコマンド叩いても一応動くので先入観でcomposer dump-autoloadとかを繰り返しトライする無駄な時間ができました。

1
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?