Beispiel #1
0
 /**
  * validate
  *
  * @param Data $data
  *
  * @return  void
  *
  * @throws ValidFailException
  */
 protected function validate(Data $data)
 {
     if (!$data->body) {
         throw new ValidFailException('Require Content');
     }
     if ($this->record->id && !UserHelper::canEditOwnPost($this->record)) {
         throw new ValidFailException('Permission deny');
     } elseif (UserHelper::isGuest()) {
         throw new ValidFailException('Permission deny');
     }
 }