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


PHP Permission::hasPermission方法代码示例

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


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

示例1: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index($card_id = false, $camp_id = false)
 {
     $data['tasks'] = Task::get_tasks($card_id, $camp_id);
     $data['createbtn'] = Permission::hasPermission('tasks.create');
     $data['editbtn'] = Permission::hasPermission('tasks.edit');
     $data['deletebtn'] = Permission::hasPermission('tasks.delete');
     return view('tasks.index', $data);
 }
开发者ID:mahitiinfo,项目名称:rubanbridge,代码行数:13,代码来源:TaskController.php

示例2: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($this->auth->guest() && $request->ajax()) {
         return response('Unauthorized.', 401);
     }
     /*
     |--------------------------------------------------------------------------
     | Admin auth filter
     |--------------------------------------------------------------------------
     | You need to give your routes a name before using this filter.
     | I assume you are using resource. so the route for the UsersController index method
     | will be admin.users.index then the filter will look for permission on users.view
     | You can provide your own rule by passing a argument to the filter
     |
     */
     $userRule = null;
     // no special route name passed, use the current name route
     if (is_null($userRule)) {
         $explode = explode('.', Route::currentRouteName());
         if (count($explode) < 3) {
             $userRule = Route::currentRouteName();
         } else {
             $userRule = $explode[1] . '.' . $explode[2];
         }
     }
     $userRule = str_replace("-", '.', $userRule);
     // no access to the request page and request page not the root admin page
     if (!Permission::hasPermission($userRule) && $userRule !== 'ruban.home') {
         $redirect['route'] = 'ruban.home';
         $redirect['with'] = 'danger';
         $redirect['message'] = trans('ruban.permissions.access_denied');
     } else {
         if (!Permission::hasPermission($userRule) && $userRule === 'ruban.home') {
             //can't see the admin home page go back to home site page
             $redirect['route'] = 'auth.logout';
             $redirect['with'] = 'danger';
             $redirect['message'] = trans('ruban.permissions.access_denied');
         }
     }
     if (isset($redirect['route'])) {
         return Redirect::route($redirect['route'])->with($redirect['with'], $redirect['message']);
     }
     return $next($request);
 }
开发者ID:mahitiinfo,项目名称:rubanbridge,代码行数:51,代码来源:Authenticate.php

示例3: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $data['dispute'] = Dispute::findOrFail($id);
     $data['projects'] = Dispute::getlists(Project::get_payouts(2, 0));
     $data['cancelbtn'] = Permission::hasPermission('disputes.index');
     return view('disputes.edit', $data);
 }
开发者ID:mahitiinfo,项目名称:rubanbridge,代码行数:13,代码来源:DisputeController.php

示例4: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $data['permission'] = Permission::findOrFail($id);
     $data['cancelbtn'] = Permission::hasPermission('permissions.index');
     return view('permissions.edit', $data);
 }
开发者ID:mahitiinfo,项目名称:rubanbridge,代码行数:12,代码来源:PermissionController.php

示例5: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $data['group'] = $group = Group::find($id);
     if ($group) {
         $data['permissions'] = Permission::all();
         $data['userPermissions'] = Permission::formatpermission($group->permissions);
         $data['cancelbtn'] = Permission::hasPermission('groups.index');
         return view('groups.edit', $data);
     } else {
         Session::flash('danger', Lang::get('ruban.group.notfound'));
         return Redirect::route('ruban.groups.index');
     }
 }
开发者ID:mahitiinfo,项目名称:rubanbridge,代码行数:19,代码来源:GroupController.php

示例6: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response*/
 public function edit($id)
 {
     $data['district'] = $district = District::find($id);
     if ($district) {
         $data['projects'] = Project::orderby('name', 'asc')->lists('name', 'id');
         $data['cancelbtn'] = Permission::hasPermission('districts.index');
         return view('districts.edit', $data);
     } else {
         Session::flash('danger', Lang::get('ruban.district.notfound'));
         return Redirect::route('ruban.districts.index');
     }
 }
开发者ID:mahitiinfo,项目名称:rubanbridge,代码行数:17,代码来源:DistrictController.php

示例7: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $data['card'] = $card = Card::find($id);
     if ($card) {
         $data['sectors'] = Sector::lists('name', 'id');
         $data['districts'] = District::groupby($this->district)->lists($this->district, 'id');
         $data['projects'] = Project::orderby('name', 'asc')->lists('name', 'id');
         $data['listbtn'] = Permission::hasPermission('cards.update');
         return view('cards.edit', $data);
     } else {
         Session::flash('danger', Lang::get('ruban.card.notfound'));
         return Redirect::route('ruban.cards.index');
     }
 }
开发者ID:mahitiinfo,项目名称:rubanbridge,代码行数:20,代码来源:CardController.php

示例8: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $data['project'] = $project = Project::find($id);
     if ($project) {
         $data['sectors'] = Sector::lists('name', 'id');
         $data['states'] = State::lists('state', 'id');
         $data['districts'] = District::where('state_id', $data['project']->state_id)->lists('district', 'id');
         $data['taluks'] = Taluk::where('district_id', $data['project']->district_id)->lists('taluk', 'id');
         $data['cancelbtn'] = Permission::hasPermission('projects.index');
         return view('projects.edit', $data);
     } else {
         Session::flash($this->danger, Lang::get('ruban.project.notfound'));
         return Redirect::route('ruban.projects.index');
     }
 }
开发者ID:mahitiinfo,项目名称:rubanbridge,代码行数:21,代码来源:ProjectController.php

示例9: updateprofile

 /**
  * Update the profile
  *
  * @param  int  $id
  * @return Response
  */
 public function updateprofile($id)
 {
     $data['user'] = User::findOrFail($id);
     $data['sectors'] = Sector::lists('name', 'id');
     $data['districts'] = District::lists('district', 'id');
     $districtsselected = PartnerDistrict::get_districts_selected($id);
     $data['districtsselected'] = PartnerDistrict::format_selected($districtsselected);
     $data['cancelbtn'] = Permission::hasPermission('users.index');
     return view('users.profile', $data);
 }
开发者ID:mahitiinfo,项目名称:rubanbridge,代码行数:16,代码来源:UserController.php


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