findByRouteName() public method

finds a record by it's slug
public findByRouteName ( $name, string $versionName = null, boolean $editing = false ) : Page
$name
$versionName string
$editing boolean
return Page
Ejemplo n.º 1
0
 /**
  * Displays details of a page
  *
  * @return Response
  */
 public function show()
 {
     // what does it mean to be in editing mode? right now it is just when you are logged in
     $editing = !is_null(\Auth::user());
     //&& Input::get('editing', false);
     $pageVersionHash = $this->Input->get('page_version_share', null);
     $pageVersionName = $this->Input->get('page_version', null);
     $page = $pageVersionHash ? $this->PagesRepository->findByRouteNameAndPreviewHash($this->Route->currentRouteName(), $pageVersionHash) : $this->PagesRepository->findByRouteName($this->Route->currentRouteName(), $pageVersionName, $editing);
     $localized = $this->PagesRepository->findLocalizedPage($page);
     return $localized ? $this->Redirect->route($localized->route_name) : $this->retrieveResponse($page);
 }
Ejemplo n.º 2
0
 /**
  * Displays details of a page
  *
  * @return Response
  */
 public function show()
 {
     // what does it mean to be in editing mode? right now it is just when you are logged in
     $editing = \DeviseUser::checkConditions('canUseDeviseEditor');
     //&& Input::get('editing', false);
     $pageVersionHash = $this->Input->get('page_version_share', null);
     $pageVersionName = $this->Input->get('page_version', null);
     $page = $pageVersionHash ? $this->PagesRepository->findByRouteNameAndPreviewHash($this->Route->currentRouteName(), $pageVersionHash) : $this->PagesRepository->findByRouteName($this->Route->currentRouteName(), $pageVersionName, $editing);
     $localized = $this->PagesRepository->findLocalizedPage($page);
     return $localized ? $this->retrieveLocalRedirect($localized) : $this->retrieveResponse($page);
 }