/**
  * @inheritdoc
  */
 public function update(JsonApiRequest $request)
 {
     /** @var Board $model */
     $model = parent::update($request);
     event(new BoardUpdatedEvent($model));
     return $model;
 }
 /**
  * @inheritDoc
  */
 protected function validateModelOnUpdate(Model $model, Schema $schema, ErrorCollection $errors)
 {
     /** @var Comment $model */
     parent::validateModelOnUpdate($model, $schema, $errors);
     $this->validateAttributes($model->getAttributes(), [Comment::FIELD_TEXT => 'required'], $schema, $errors);
     if ($model->isDirty(Comment::FIELD_ID_POST) === true) {
         $errors->addRelationshipError(CommentSchema::REL_POST, 'Changing is not allowed.');
     }
 }
 /**
  * @inheritDoc
  */
 protected function validateModelOnUpdate(Model $model, Schema $schema, ErrorCollection $errors)
 {
     /** @var User $model */
     parent::validateModelOnUpdate($model, $schema, $errors);
     $this->validateAttributes($model->getDirty(), [User::FIELD_TITLE => 'max:' . User::LENGTH_TITLE, User::FIELD_FIRST_NAME => 'sometimes|required|max:' . User::LENGTH_FIRST_NAME, User::FIELD_LAST_NAME => 'max:' . User::LENGTH_LAST_NAME, User::FIELD_EMAIL => 'sometimes|required|email|max:' . User::LENGTH_EMAIL . '|unique:' . User::TABLE_NAME . ',' . User::FIELD_EMAIL, User::FIELD_LANGUAGE => 'max:' . User::LENGTH_LANGUAGE], $schema, $errors);
     $this->validateBelongsToRelationships([User::REL_ROLE => $model->{User::FIELD_ID_ROLE}], [User::REL_ROLE => 'sometimes|required|exists:' . Role::TABLE_NAME . ',' . Role::FIELD_ID], $schema, $errors);
 }
 /**
  * @inheritDoc
  */
 protected function validateModelOnUpdate(Model $model, Schema $schema, ErrorCollection $errors)
 {
     /** @var Post $model */
     parent::validateModelOnUpdate($model, $schema, $errors);
     $this->validateAttributes($model->getAttributes(), [Post::FIELD_TITLE => 'sometimes|required|max:' . Post::LENGTH_TITLE, Post::FIELD_TEXT => 'sometimes|required'], $schema, $errors);
     if ($model->isDirty(Post::FIELD_ID_BOARD) === true) {
         $errors->addRelationshipError(PostSchema::REL_BOARD, 'Changing is not allowed.');
     }
 }
 /**
  * Constructor.
  */
 public function __construct()
 {
     parent::__construct(new Role(), new RolesAuthorizations());
 }