/** * When a campaign has no subscribers */ public function recreateCampaign($campaign) { if ($campaign->count_subscriber > 0) { throw new ApplicationException('Sorry, you cannot recreate this campaign because it has subscribers belonging to it.'); } $campaign->status = MessageStatus::getDraftStatus(); $campaign->save(); }
public function beforeCreate() { if (empty($this->subject)) { $this->subject = $this->name; } if (empty($this->status_id)) { $this->status_id = MessageStatus::getDraftStatus()->id; } if (empty($this->content)) { $this->rebuildContent(); } }