artisanコマンドを使わずにクラスを作成した際にnot foundになった話
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
おしまい。よかったよかった。
Author And Source
この問題について(artisanコマンドを使わずにクラスを作成した際にnot foundになった話), 我々は、より多くの情報をここで見つけました https://qiita.com/rokumura7/items/634d2c5862e4b1d3f2ca著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .