album_id != $album->id) { // attempt to use other album's photo throw new ApplicationException(Lang::get('graker.photoalbums::lang.errors.not_this_album')); } } catch (Exception $e) { return Response::json($e->getMessage(), 400); } // set front id $album->front_id = $photo->id; $album->save(); $this->initRelation($album, 'photos'); return $this->relationRefresh('photos'); } /** * * Returns path to reorder current album * * @return string */ protected function getReorderPath() { if (!isset($this->vars['formModel']->id)) { return ''; } $uri = \Backend::url('graker/photoalbums/reorder/album/' . $this->vars['formModel']->id); return $uri; } }