Пример #1
0
 public static function boot()
 {
     parent::boot();
     static::creating(function ($obj) {
         $obj->campaign_id = Campaign::current()->id;
         if (!isset($obj->collect_participant_info)) {
             $obj->collect_participant_info = false;
         }
     });
 }
Пример #2
0
 public static function boot()
 {
     parent::boot();
     static::created(function ($obj) {
         $obj->campaigns()->sync([Campaign::current()->id]);
         // foreach( CallToAction::all() as $cta ) {
         //     $data = [
         //         'beneficiary_id' => $obj->id,
         //         'call_to_action_id' => $cta->id,
         //         'participating' => false,
         //     ];
         //     BeneficiaryCallToAction::create($data);
         // }
     });
 }