public static function boot() { parent::boot(); static::created(function ($obj) { $obj->campaigns()->sync([Campaign::current()->id]); }); }
public function run() { DB::table('organizations')->delete(); $o = Organization::create(['id' => 1, 'permalink' => 'abc', 'name' => 'Parent Church', 'abbreviation' => 'PC', 'address1' => '4350 North Point Parkway', 'city' => 'Alpharetta', 'state' => 'GA', 'postal_code' => '30022', 'country' => 'US', 'from_email' => '*****@*****.**']); $o = Organization::create(['id' => 2, 'permalink' => 'bcd', 'parent_organization_id' => 1, 'name' => 'Child Church', 'abbreviation' => 'CC', 'address1' => '4350 North Point Parkway', 'city' => 'Alpharetta', 'state' => 'GA', 'postal_code' => '30022', 'country' => 'US', 'from_email' => '*****@*****.**']); $o = Organization::create(['id' => 3, 'permalink' => 'cde', 'parent_organization_id' => 1, 'name' => 'Third Church', 'abbreviation' => 'TC', 'address1' => '4350 North Point Parkway', 'city' => 'Alpharetta', 'state' => 'GA', 'postal_code' => '30022', 'country' => 'US', 'from_email' => '*****@*****.**']); $o = Organization::create(['id' => 4, 'permalink' => 'def', 'name' => 'Unrelated Church', 'abbreviation' => 'UC', 'address1' => '4350 North Point Parkway', 'city' => 'Alpharetta', 'state' => 'GA', 'postal_code' => '30022', 'country' => 'US', 'from_email' => '*****@*****.**']); }