protected function validate() { $valid = parent::validate(); if (!$valid->valid()) { return $valid; } if ($this->Channel === 'NONE') { return $valid->error('You must set a valid channel.'); } if (empty($this->Message)) { return $valid->error('You must set a Message.'); } if ($this->Channel === 'MEMBERS' && $this->Recipients()->count() === 0) { return $valid->error('You must set at least one recipient for MEMBERS channel.'); } return $valid; }
protected function validate() { $valid = parent::validate(); if (!$valid->valid()) { return $valid; } if ($this->Channel === 'NONE') { return $valid->error('You must set a valid channel.'); } if (empty($this->Message)) { return $valid->error('You must set a Message.'); } if ($this->Channel === 'MEMBERS' && $this->Recipients()->count() === 0) { return $valid->error('You must set at least one recipient for MEMBERS channel.'); } if ($this->Channel === 'EVENT' && $this->EventID == 0) { return $valid->error('You must set at least one Published Event for EVENT channel.'); } if ($this->Channel === 'GROUP' && $this->GroupID == 0) { return $valid->error('You must set at least one group for GROUP channel.'); } return $valid; }