当前位置: 首页>>代码示例>>PHP>>正文


PHP Request::is方法代码示例

本文整理汇总了PHP中Request::is方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::is方法的具体用法?PHP Request::is怎么用?PHP Request::is使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Request的用法示例。


在下文中一共展示了Request::is方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: render

 /**
  * Render an exception into an HTTP response.
  *
  * @param Request   $request
  * @param Exception $exception
  *
  * @return Response
  */
 public function render($request, Exception $exception)
 {
     if (!$request->is(config('jsonapi.url'))) {
         return parent::render($request, $exception);
     }
     return $this->handle($request, $exception);
 }
开发者ID:askedio,项目名称:laravel-cruddy,代码行数:15,代码来源:Handler.php

示例2: __construct

 /**
  * Initializer.
  *
  * @access   public
  * @return BaseController
  */
 public function __construct()
 {
     $is_admin = Request::is('admin*');
     $is_backend = Request::is('backend*');
     /* Set middleware(s) based on route URLs */
     if ($is_admin || $is_backend) {
         $this->middleware('auth');
         if ($is_backend) {
             // Backend specific middleware
             $this->middleware('auth.backend');
         }
         $this->middleware('auth.permissions');
         if (!Request::is('*users/change-password')) {
             // No validation for stale password if password is being changed
             $this->middleware('auth.pw_6_months');
         }
     }
     list($this->link_type, $this->link, $this->layout, $this->current_theme) = current_section();
     View::share('link_type', $this->link_type);
     View::share('current_theme', $this->current_theme);
     $website_settings = Setting::lists('value', 'name')->all();
     View::share('website_settings', $website_settings);
     $locale = Setting::value('language');
     App::setLocale($locale);
     Lang::setLocale($locale);
     $this->user = current_user();
     View::share('current_user', $this->user);
     View::share('current_user_companies', current_user_companies());
 }
开发者ID:doptor,项目名称:doptor,代码行数:35,代码来源:BaseController.php

示例3: set_active

/**
 * Help in setting the class of the active link to 'active'
 * If another class is required,
 * pass a third parameter of class name
 * @param $path
 * @param string $secondPath
 * @param string $active
 * @return string
 */
function set_active($path, $secondPath = '', $active = 'active')
{
    if ($path == 'admin/search' && strpos(Request::path(), 'admin/search') !== false) {
        return $active;
    }
    return Request::is($path) || Request::is($secondPath) ? $active : '';
}
开发者ID:Korogba,项目名称:mathlibrary,代码行数:16,代码来源:helpers.php

示例4: set_expanded

/**
 * @param array $array
 * @param string $active
 * @return string
 */
function set_expanded($array = array(), $active = 'nav-expanded')
{
    $path = Request::path();
    if (in_array($path, $array)) {
        return Request::is($path) ? $active : '';
    }
}
开发者ID:norja25,项目名称:16._julijs,代码行数:12,代码来源:helpers.php

示例5: showSocialShareTools

function showSocialShareTools()
{
    if (!\Request::is('admin/*') && !\Request::is('blog/admin/*')) {
        return true;
    }
    return false;
}
开发者ID:ryanrobertsname,项目名称:giftertipster.com,代码行数:7,代码来源:helper_functions.php

示例6: setActive

function setActive($path, $strict = false, $active = 'active')
{
    if ($strict) {
        return Request::is($path) ? $active : '';
    }
    return strpos(Request::path(), $path) !== false ? $active : '';
}
开发者ID:unknowncoders,项目名称:plPredict,代码行数:7,代码来源:helpers.php

示例7: printMenu

 public static function printMenu($menus, $class = null)
 {
     echo '<ul' . ($class ? ' class="' . $class . '"' : '') . '>';
     foreach ($menus as $menu) {
         if (!$menu['hide']) {
             if (!array_key_exists('path', $menu)) {
                 echo '<li><span>' . \Lang::get('redminportal::menus.' . $menu['name']) . '</span>';
             } else {
                 if ($menu['path'] == '') {
                     echo '<li><span>' . \Lang::get('redminportal::menus.' . $menu['name']) . '</span>';
                 } else {
                     if (\Request::is($menu['path']) or \Request::is($menu['path'] . '/*')) {
                         echo '<li class="active">';
                     } else {
                         echo '<li>';
                     }
                     echo '<a href="' . \URL::to($menu['path']) . '">' . \Lang::get('redminportal::menus.' . $menu['name']) . '</a>';
                 }
             }
             // If got children menu
             if (array_key_exists('children', $menu)) {
                 RHelper::printMenu($menu['children']);
             }
             echo '</li>';
         }
     }
     echo '</ul>';
 }
开发者ID:aguaragazu,项目名称:redminportal,代码行数:28,代码来源:Rhelper.php

示例8: build

 /**
  * Build a navigation menu from an array with the following structure: <br/>
  * $navbar = array( <br/>
  *		['url'=>'url',           'textkey'=>'public.title', 'nopattern' => true ], <br/>
  *		['url'=>'url/products',  'textkey'=>'public.products.title' ], <br/>
  *		['url'=>'url/clients',   'textkey'=>'public.clients.title', 'icon' => 'fa-users' ], <br/>
  *);
  */
 public static function build(array $_menu, $_currentLocale = '', $_addItemClass = '')
 {
     $str = '';
     foreach ($_menu as $key => $option) {
         $icon = isset($option['icon']) ? '<i class="fa ' . $option['icon'] . ' fa-fw"></i> ' : '';
         if (isset($option['divider'])) {
             $str .= '<li class="divider"></li>';
         } else {
             if (isset($option['submenu'])) {
                 $requestPattern = $_currentLocale . ($option['url'] == '' ? '' : '/' . $option['url'] . '*');
                 $isActive = '';
                 $isOpenned = '';
                 if (Request::is($requestPattern)) {
                     $isActive = ' active';
                     $isOpenned = ' in';
                 }
                 $str .= '<li class="' . $_addItemClass . ' list-toggle' . $isActive . '">' . '<a class="accordion-toggle" href="#collapse-' . $key . '" data-toggle="collapse">' . $icon . trans($option['textkey']) . '</a>' . '<ul id="collapse-' . $key . '" class="collapse' . $isOpenned . '">' . self::build($option['submenu'], $_currentLocale) . '</ul>' . '</li>';
             } else {
                 $submenusPattern = isset($option['nopattern']) ? '' : '*';
                 $requestPattern = $_currentLocale . ($option['url'] == '' ? '' : '/' . $option['url'] . $submenusPattern);
                 //$requestPattern = $_currentLocale . $option['url'] . $submenusPattern;
                 $isActive = \Request::is($requestPattern) ? ' active' : '';
                 $str .= '<li class="' . $_addItemClass . $isActive . '">' . '<a href="' . \URL::to($option['url']) . '">' . $icon . trans($option['textkey']) . '</a>' . '</li>';
             }
         }
     }
     return $str;
 }
开发者ID:ajgallego,项目名称:laravel-helpers,代码行数:36,代码来源:HelpMenu.php

示例9: show_nav

 /**
  * Generate a URL to a controller action.
  *
  * @param  string  $name
  * @param  array   $parameters
  * @param  bool    $absolute
  * @return string
  */
 function show_nav($url)
 {
     $className = '';
     if ($url == Request::is('admin/post*') || $url == Request::is('admin/upload*')) {
         $className = 'active';
     }
     return $className;
 }
开发者ID:namnv609,项目名称:datvd-laravel5-tutorial,代码行数:16,代码来源:helper.php

示例10: set_active

 /**
  * Set active class if request is in path.
  *
  * @param string $path
  * @param array  $classes
  * @param string $active
  *
  * @return string
  */
 function set_active($path, array $classes = [], $active = 'active')
 {
     if (Request::is($path)) {
         $classes[] = $active;
     }
     $class = e(implode(' ', $classes));
     return empty($classes) ? '' : "class=\"{$class}\"";
 }
开发者ID:gitaminhq,项目名称:gitamin,代码行数:17,代码来源:Helpers.php

示例11: setBroadcasterActive

function setBroadcasterActive($path, $active = "active")
{
    if ($path == "/") {
        return URL::route('broadcasterHome') === URL::current() ? $active : "";
    }
    $path = "broadcaster" . $path;
    return Request::is($path . '*') ? $active : "";
}
开发者ID:jerryamatya,项目名称:broadcaster,代码行数:8,代码来源:helpers.php

示例12: rules

 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     $rules = ['title' => 'required|min:3|max:100|unique:articles', 'body' => 'required', 'published_at' => 'required'];
     if (\Request::is('article/*') && \Request::isMethod('PUT')) {
         $rules['title'] = 'required|min:3|max:100|unique:articles,title,' . $this->article->id;
     }
     return $rules;
 }
开发者ID:belhard-user,项目名称:group2,代码行数:13,代码来源:ArticleRequest.php

示例13: isInbox

 public static function isInbox()
 {
     if (Request::is("m/message/f/inbox")) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:khanhpnk,项目名称:sbds,代码行数:8,代码来源:MessageHelper.php

示例14: rules

 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     if (FacadeRequest::is('accounts/create')) {
         $response = ['first_name' => 'required|min:3', 'last_name' => 'required|min:3', 'email' => 'required|email|max:255', 'address' => 'required:min:5', 'city' => 'required:min:3', 'postal_code' => 'required:min:6', 'file' => 'required|image|mimes:jpg,jpeg,png,gif|max:900'];
     } else {
         $response = ['first_name' => 'required|min:3', 'last_name' => 'required|min:3', 'email' => 'required|email|max:255', 'address' => 'required:min:5', 'city' => 'required:min:3', 'postal_code' => 'required:min:6', 'file' => 'image|mimes:jpg,jpeg,png,gif|max:900'];
     }
     return $response;
 }
开发者ID:rkang30,项目名称:newdev_L5.1,代码行数:14,代码来源:AccountRequest.php

示例15: is_current_model

/**
 * 检查当前url是否属于菜单中定义的模式,完成菜单激活状态
 *
 * @param array $pattern app/config/menu.php中的pattern
 *
 * @return boolean
 */
function is_current_model(array $pattern)
{
    foreach ($pattern as $ptn) {
        if (Request::is($ptn)) {
            return true;
        }
    }
    return false;
}
开发者ID:astronautyan,项目名称:O2OMobile_PHP,代码行数:16,代码来源:common.php


注:本文中的Request::is方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。