Illuminate\Routing\Router::has PHP Method

has() public method

Check if a route with the given name exists.
public has ( string $name ) : boolean
$name string
return boolean
    public function has($name)
    {
        return $this->routes->hasNamedRoute($name);
    }

Usage Example

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;
 }
All Usage Examples Of Illuminate\Routing\Router::has