LoginSignup
1
1

More than 5 years have passed since last update.

artisanコマンドを使わずにクラスを作成した際にnot foundになった話

Posted at

artisanコマンドを使わずにクラスを作成した際にnot foundになった話

背景

Seederクラス内で共通して定義したい事があったので、AbstractSeederを作成。
これをUsersTableSeederにextendsでくっつけました。

UsersTableSeeder.php
  use App\Database\Seeds\AbstractSeeder;
  class UsersTableSeeder extends AbstractSeeder {
    ・・・処理・・・
  }

事象

シーディングを実行すると、not found。ふむ。

  $ php artisan db:seed
  Seeding: UsersTableSeeder
  PHP Fatal error:  Class 'App\Database\Seeds\AbstractSeeder' not found in /hoge/database/seeds/UsersTableSeeder.php on line 5
  Symfony\Component\Debug\Exception\FatalErrorException  : Class 'App\Database\Seeds\AbstractSeeder' not found

解決

Composerのオートロード機能使ってあげましょう。

  $ composer dump-autoload

おしまい。よかったよかった。

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