Calling a Repository method from a Seeder class

Posted 3 years ago by SergioGregorutti

Hi all,

Im trying to call a Repository method from a Seeder class but I get an error:

[ErrorException]                                                                                                                                             
Non-static method Argemundo\Repositories\GuideRepository::updateGuideCategories() should not be called statically, assuming $this from incompatible context

This is my seeder class:

<?php
use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model;
use Argemundo\Repositories\GuideRepository;

class CommerceCategoriesSeeder extends Seeder {

    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        Model::unguard();

        DB::table('commerce_category')->insert([
            'commerce_id' => 1,
            'category_id' => 9,
            'category_type' => 'Argemundo\CommercesCategoryLevel1',
            'children' => 2]);

        GuideRepository::updateGuideCategories();
    }

}

I dont know is this is possible. Can someone help me?

Thanks in advance!

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.