This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

os19392
os19392

Hi i want to seed default settings to one of my Settings Model but why only "sometimes" works?

class SeedSettings extends Seeder
{
    public function run()
    {
        $settings = Settings::instance();
        $settings->siteName = 'Default site name';
        $settings->save();
    }
}

If i run october:up one time works another time does not work it's kind a "random"

It's possible to save into a Eloquent or Model Settings inside a migration or seeder? i think that it's kind a locked the save method

Thank you

alxy
alxy

You should probably use initSettingsData() to supply default values.

Scott
Scott

Thanks for the old answer Alxy! I never knew about this method, and it was exactly what I was looking for :)

1-3 of 3

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.