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


PHP access函数代码示例

本文整理汇总了PHP中access函数的典型用法代码示例。如果您正苦于以下问题:PHP access函数的具体用法?PHP access怎么用?PHP access使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: getDeleteButtonAttribute

 /**
  * @return string
  */
 public function getDeleteButtonAttribute()
 {
     if (access()->can('delete-permissions')) {
         return '<a href="' . route('admin.access.roles.permissions.destroy', $this->id) . '" class="btn btn-xs btn-danger" data-method="delete"><i class="fa fa-times" data-toggle="tooltip" data-placement="top" title="' . trans('crud.delete_button') . '"></i></a>';
     }
     return '';
 }
开发者ID:mikimaine,项目名称:ecommerce,代码行数:10,代码来源:PermissionAttribute.php

示例2: getDeleteButtonAttribute

 /**
  * @return string
  */
 public function getDeleteButtonAttribute()
 {
     if (access()->allow('delete-categories')) {
         return '<a href="' . route('admin.quiz.categories.destroy', $this->id) . '" data-method="delete" class="btn btn-xs btn-danger"><i class="fa fa-trash" data-toggle="tooltip" data-placement="top" title="' . trans('buttons.general.crud.delete') . '"></i></a>';
     }
     return '';
 }
开发者ID:dovbeta,项目名称:teststool,代码行数:10,代码来源:CategoryAttribute.php

示例3: handle

 /**
  * @param  $request
  * @param  callable      $next
  * @param  $permission
  * @return mixed
  */
 public function handle($request, Closure $next, $permission)
 {
     if (!access()->allow($permission)) {
         return redirect()->route('frontend.index')->withFlashDanger(trans('auth.general_error'));
     }
     return $next($request);
 }
开发者ID:farrukhcw,项目名称:laravel-5-boilerplate,代码行数:13,代码来源:RouteNeedsPermission.php

示例4: getDeleteButtonAttribute

 /**
  * @return string
  */
 public function getDeleteButtonAttribute()
 {
     if (access()->can('destroy-team')) {
         return '<a href="' . route('team.destroy', $this->id) . '" data-method="delete" class="btn btn-xs btn-danger"><i class="fa fa-trash" data-toggle="tooltip" data-placement="top" title="' . trans('crud.delete_button') . '"></i></a>';
     }
     return '';
 }
开发者ID:faycal1,项目名称:Ball,代码行数:10,代码来源:TeamAttribute.php

示例5: getResultsButtonAttribute

 /**
  * @return string
  */
 public function getResultsButtonAttribute()
 {
     if (access()->allow('see-results') && $this->isCompleted()) {
         return '<a href="' . route('admin.quiz.results.show', $this->id) . '" class="btn btn-xs btn-primary"><i class="fa fa-list" data-toggle="tooltip" data-placement="top" title="' . trans('buttons.backend.quiz.tasks.results') . '"></i></a>';
     }
     return '';
 }
开发者ID:dovbeta,项目名称:teststool,代码行数:10,代码来源:TaskAttribute.php

示例6: getDeleteButtonAttribute

 /**
  * @return string
  */
 public function getDeleteButtonAttribute()
 {
     if (access()->can('view-innovate-ecommerce')) {
         return '<a href="' . route('admin.check_out_agreement.destroy', $this->id) . '" data-method="delete" class="btn btn-xs btn-danger"><i class="fa fa-trash" data-toggle="tooltip" data-placement="top" title="' . trans('crud.delete_button') . '"></i></a>';
     }
     return '';
 }
开发者ID:mikimaine,项目名称:ecommerce,代码行数:10,代码来源:CheckOutAgreementAttribute.php

示例7: loginAs

 /**
  * @param User $user
  * @param ManageUserRequest $request
  * @return \Illuminate\Http\RedirectResponse
  * @throws GeneralException
  */
 public function loginAs(User $user, ManageUserRequest $request)
 {
     // Overwrite who we're logging in as, if we're already logged in as someone else.
     if (session()->has('admin_user_id') && session()->has('temp_user_id')) {
         // Let's not try to login as ourselves.
         if (access()->id() == $user->id || session()->get('admin_user_id') == $user->id) {
             throw new GeneralException('Do not try to login as yourself.');
         }
         // Overwrite temp user ID.
         session(['temp_user_id' => $user->id]);
         // Login.
         access()->loginUsingId($user->id);
         // Redirect.
         return redirect()->route("frontend.index");
     }
     app()->make(Auth::class)->flushTempSession();
     // Won't break, but don't let them "Login As" themselves
     if (access()->id() == $user->id) {
         throw new GeneralException("Do not try to login as yourself.");
     }
     // Add new session variables
     session(["admin_user_id" => access()->id()]);
     session(["admin_user_name" => access()->user()->name]);
     session(["temp_user_id" => $user->id]);
     // Login user
     access()->loginUsingId($user->id);
     // Redirect to frontend
     return redirect()->route("frontend.index");
 }
开发者ID:rappasoft,项目名称:laravel-5-boilerplate,代码行数:35,代码来源:UserAccessController.php

示例8: redirectPath

 /**
  * Where to redirect users after login / registration.
  * @return string
  */
 public function redirectPath()
 {
     if (access()->allow('view-backend')) {
         return route('admin.dashboard');
     }
     return route('frontend.user.dashboard');
 }
开发者ID:blomdahldaniel,项目名称:laravel-5-boilerplate,代码行数:11,代码来源:AuthController.php

示例9: init

 /**
  * Init
  */
 public function init()
 {
     parent::init();
     if (access('Dev.*') && cogear()->config->development) {
         hook('done', array($this, 'finish'));
     }
 }
开发者ID:brussens,项目名称:cogear2,代码行数:10,代码来源:Gear.php

示例10: handle

 /**
  * @param $request
  * @param callable $next
  * @param $role
  * @return mixed
  */
 public function handle($request, Closure $next, $role)
 {
     if (!access()->hasRole($role)) {
         return redirect('/')->withFlashDanger("You do not have access to do that.");
     }
     return $next($request);
 }
开发者ID:shiruken1,项目名称:LEIAs,代码行数:13,代码来源:RouteNeedsRole.php

示例11: handle

 /**
  * @param  $request
  * @param callable $next
  * @param  $permission
  *
  * @return mixed
  */
 public function handle($request, Closure $next, $permission)
 {
     if (!access()->can($permission)) {
         return redirect('/')->withFlashDanger('You do not have access to do that.');
     }
     return $next($request);
 }
开发者ID:mikimaine,项目名称:ecommerce,代码行数:14,代码来源:RouteNeedsPermission.php

示例12: hookRouterExec

 /**
  * Хук Роутера
  *
  * @param object $Router
  * @param Callback $callback
  */
 public function hookRouterExec($Router, Callback $callback)
 {
     if (!access($callback->getCallback(0)->gear . '.*') && !access($callback->getCallback(0)->gear . '.' . str_replace('_action', '', $callback->getCallback(1)))) {
         event('403');
         return FALSE;
     }
 }
开发者ID:brussens,项目名称:cogear2,代码行数:13,代码来源:Gear.php

示例13: browse

 function browse()
 {
     $this->user_group_model->can_access(VIEW_LIST_NEWS, null, null);
     $filter = '';
     //view my news
     if (!access(VIEW_ALL_NEWS)) {
         $filter .= ' AND poster = ' . $_SESSION['userdata']['userid'];
     }
     $start = (int) $this->uri->segment(5, 0);
     $limit_per_page = 30;
     $cat_id = (int) $this->uri->segment(3, 0);
     $newsType = $this->uri->segment(4, 'news');
     $this->load->model('ci_newsmodel');
     // Instantiate the model
     $aryNewsList = array();
     $aryNewsList = $this->ci_newsmodel->getNewsList($newsType, $cat_id, $start, $limit_per_page, $filter);
     $the_results['aryNewsList'] = $aryNewsList;
     $the_results['numOfNews'] = $this->ci_newsmodel->table_record_count;
     $the_results['newsType'] = $newsType;
     $this->load->library('pagination');
     $this->load->helper('url');
     $config['total_rows'] = $this->ci_newsmodel->table_record_count;
     $config['per_page'] = $limit_per_page;
     $config['uri_segment'] = 5;
     $config['num_links'] = 3;
     $config['base_url'] = base_url() . 'news/browse/' . $cat_id . '/' . $newsType;
     $this->pagination->initialize($config);
     $the_results['page_links'] = $this->pagination->create_links();
     $the_results['title'] = 'News List';
     $the_results['cat_id'] = $cat_id;
     $this->_display('/ci_news/ci_newsgrid', $the_results);
 }
开发者ID:Chitu10993610,项目名称:azx111,代码行数:32,代码来源:news.php

示例14: handle

 /**
  * @param $request
  * @param callable $next
  * @param null $params
  * @return \Illuminate\Contracts\Routing\ResponseFactory|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Symfony\Component\HttpFoundation\Response
  */
 public function handle($request, Closure $next, $params = null)
 {
     $assets = $this->getAssets($request, $params);
     if (!access()->hasRoles($assets['roles'], $assets['needsAll'])) {
         return $this->getRedirectMethodAndGo($request, $params);
     }
     return $next($request);
 }
开发者ID:hasokeric,项目名称:laravel-5-boilerplate,代码行数:14,代码来源:RouteNeedsRole.php

示例15: index

 /**
  * @return \Illuminate\View\View
  */
 public function index()
 {
     $organizations = access()->user()->organizations()->get();
     if (count($organizations) == 0) {
         return redirect()->to('/');
     }
     $this_url = \Request::url();
     return view('frontend.user_organizations')->with('this_url', $this_url)->with('organizations', $organizations);
 }
开发者ID:binaryk,项目名称:energy,代码行数:12,代码来源:UserOrganizationsController.php


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