コード例 #1
0
ファイル: GroupRequest.php プロジェクト: ankhzet/Ankh
 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;
 }
コード例 #2
0
ファイル: AuthorRequest.php プロジェクト: ankhzet/Ankh
 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;
 }
コード例 #3
0
ファイル: PageRequest.php プロジェクト: ankhzet/Ankh
 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;
 }
コード例 #4
0
ファイル: RestfulController.php プロジェクト: ankhzet/Ankh
 /**
  * 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');
 }