URL::route PHP Метод

route() публичный статический Метод

Get the URL to a named route.
public static route ( string $name, mixed $parameters = [], boolean $absolute = true ) : string
$name string
$parameters mixed
$absolute boolean
Результат string
        public static function route($name, $parameters = array(), $absolute = true)
        {
            return \Illuminate\Routing\UrlGenerator::route($name, $parameters, $absolute);
        }

Usage Example

Пример #1
0
 public function addItem($perams = array())
 {
     $defaults = array('text' => '', 'URL' => '#', 'reference' => 0, 'parent' => false, 'weight' => 1, 'class' => '', 'children' => array(), 'icon' => '', 'attributes' => array(), 'protected' => false);
     if (isset($perams['URL']) && preg_match("#^route:(.*)\$#is", $perams['URL'], $match)) {
         if (isset($perams['protected']) && $perams['protected']) {
             $perams['protected'] = $match[1];
         }
         if ($this->entrust && \Auth::check()) {
             $roles = \Auth::user()->roles()->get();
             $allowed = true;
             foreach ($roles as $role) {
                 foreach ($role->perms as $perm) {
                     if (in_array($match[1], $perm->protected_routes)) {
                         $perams['URL'] = \URL::route($match[1]);
                         $this->items[] = array_merge($defaults, $perams);
                     }
                 }
             }
             return $this;
         } else {
             $perams['URL'] = \URL::route($match[1]);
         }
     }
     $this->items[] = array_merge($defaults, $perams);
     return $this;
 }
All Usage Examples Of URL::route