Php – Laravel 5: DB Seed class not found


I have this DatabaseSeeder.php:


use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model;

    class DatabaseSeeder extends Seeder {

         * Run the database seeds.
         * @return void
        public function run()


I have this file MemberInvitationSeeder.php, sibling to the DatabaseSeeder.php file


use Illuminate\Database\Seeder;
use App\MemberInvitation;

    class MemberInvitationSeeder extends Seeder {

        public function run()

            MemberInvitation::create( [
                'id' => 'BlahBlah' ,//com_create_guid(),
                'partner_id' => 1,
                'fisrt_name' => 'Thats',
                'last_name' => 'Me',
                'email' => '',
                'mobile_phone' => '444-342-4234',
                'created_at' => new DateTime
            ] );


Now I call

php artisan db:seed

and I get:

  Class MemberInvitationSeeder does not exist

I tried everything I could find including "composer dump-autoload". to no avail. What am I doing wrong?

Best Solution

Step one - generate seed:

php artisan make:seed MemberInvitationSeeder

Step two - In DatabaseSeeder.php add line:


Step three:

composer dump-autoload

Step four:

php artisan db:seed

This should work

If this isn't the clue, check the composer.json file and make sure you have code below in the "autoload" section:

"classmap": [
Related Question