public function candidate() { $author = $this->route('authors'); if (!$author) { throw new Exception('Group can be created only if author specified'); } $group = parent::candidate(); $group->author()->associate($author); return $group; }
public function input($key = NULL, $default = NULL) { $input = parent::input(); if ($link = Author::matchLink($input['link'])) { $input['link'] = $link; } if (!@$input['fio']) { $input['fio'] = $input['link']; } return $input; }
public function candidate() { $group = $this->route('groups'); if (!$group) { throw new Exception('Page can be created only if group specified'); } $page = parent::candidate(); $page->author()->associate($group->author); $page->group()->associate($group); return $page; }
/** * Update the specified entity entry in storage. * * @param EntityRequest $request * @return Response */ public function _update(EntityRequest $request, Entity $entity) { if (($deleted = !!$request->deleted()) != !!$entity->trashed()) { if ($deleted) { $entity->delete(); } else { $entity->restore(); } } if ($this->m->updateEvenTrashed($entity, $request->data())) { return $this->innerRedirect('show', $entity)->withMessage('Updated'); } throw new Exception('Update failed'); }