Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

afoysal's avatar

Error in seeding command in Laravel

I am using Laravel Framework 5.5.33. I am trying to run php artisan db:seed command but I am getting following error. My DatabaseSeeder.php file is like below.

<?php

use Illuminate\Database\Seeder;

class DatabaseSeeder extends Seeder
{
    public function run()
    {
        $this->call([
            ApplicantsTableSeeder::class,
            ApplicantSkillTableSeeder::class,
            SkillsTableSeeder::class,
        ]);
    }
}

I couldn't find out the Source of the error. Could anyone help me to find out the source ?

enter image description here

0 likes
4 replies
topvillas's avatar

Not unless you show us the seed and migration files.

1 like
topvillas's avatar

Yeah, knowing your table structure will help us see how your seed relates to it.

patrickcarlohickman's avatar

Somewhere in ApplicantSkillTableSeeder or in SkillsTableSeeder you've attempted to access ->id on a Collection, not a Model.

Without posting the code, you'll need to examine those files, find where you've used ->id, and fix the code so you're calling ->id on the desired Model.

1 like

Please or to participate in this conversation.