has() public method

Check if a route with the given name exists.
public has ( string $name ) : boolean
$name string
return boolean
Example #1
0
 /**
  * Return true if current page is $page.
  */
 public function isPage(string $page, array $parameters = []) : bool
 {
     // Check if $page is a route name
     if ($this->route->has($page)) {
         if ($parameters) {
             return $this->url->current() == $this->url->route($page, $parameters);
         }
         return $this->route->currentRouteName() == $page;
     }
     return str_replace($this->request->root() . '/', '', $this->url->full()) == $page;
 }
Example #2
0
 /**
  * Return a named route if it exists.
  *
  * @param string $url
  * @param array  $parameters
  *
  * @return string
  */
 protected function parseUrl($url, $parameters)
 {
     // If provided $url is a route name...
     if ($this->route->has($url)) {
         $url = $this->url->route($url, $parameters);
     } else {
         $url = $this->url->to($url, $parameters);
     }
     return $url;
 }
Example #3
0
 /**
  * Check if a route with the given name exists.
  *
  * @param string $name
  * @return bool 
  * @static 
  */
 public static function has($name)
 {
     return \Illuminate\Routing\Router::has($name);
 }