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


PHP Auth::user方法代码示例

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


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

示例1: authorize

 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     if (Auth::check() && Auth::user()->hasAccess('create_paper')) {
         return true;
     }
     return false;
 }
开发者ID:jhcict,项目名称:mcq,代码行数:12,代码来源:UpdatePaperRequest.php

示例2: authorize

 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     if (\Auth::user()->isModerator()) {
         return true;
     }
     return false;
 }
开发者ID:Qeenslet,项目名称:elite-lara,代码行数:12,代码来源:FileRequest.php

示例3: authorize

 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     $id = $this->route('id');
     if ($id == 0) {
         return TRUE;
     }
     return \Auth::user()->owns(\App\AmazonProduct::find($id));
 }
开发者ID:aljogabot,项目名称:AmazonStats,代码行数:13,代码来源:ProductSaveRequest.php

示例4: authorize

 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     if (\Auth::user()->level->id == 1) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:suhairi,项目名称:maintenance,代码行数:13,代码来源:PenggunaStoreRequest.php

示例5: authorize

 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     $profile = $this->route('profiles');
     if (!is_null($user = \Auth::user())) {
         return $user->is_admin || !is_null($user->profile) && $user->profile->id == $profile;
     }
     return false;
 }
开发者ID:productionEA,项目名称:pockeyt-api,代码行数:13,代码来源:AddProfilePhotoRequest.php

示例6: validator

 /**
  * Check when user updates details, that if email has changed it is not taken by another user.
  */
 public function validator()
 {
     $validator = Validator::make($this->input(), $this->rules(), $this->messages());
     $validator->sometimes('email', 'unique:users', function ($input) {
         return $input->email != \Auth::user()->email;
     });
     return $validator;
 }
开发者ID:rakeshmistrynz,项目名称:squashapp,代码行数:11,代码来源:UpdateUserRequest.php

示例7: authorize

 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     $user = \Auth::user();
     if ($user->hasRoles(['admin', 'super admin'])) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:gertjanroke,项目名称:users,代码行数:14,代码来源:RolesRequest.php

示例8: authorize

 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     $user = Auth::user();
     $group_id = $this->route('group');
     // Есть ли права на запись
     // является ли пользователь админом
     // и админ ли он этой группы
     return $user->is_admin && GroupAdmin::where('admin_id', $user->id)->where('group_id', $group_id)->exists();
 }
开发者ID:avil13,项目名称:cross-fit.loc,代码行数:14,代码来源:ProgramRequest.php

示例9: authorize

 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     $reportId = $this->route('id');
     $report = ExpenseReport::find($reportId);
     if ($report->owner_id == \Auth::user()->id) {
         return true;
     }
     return false;
 }
开发者ID:abada,项目名称:SettleUp-Laravel,代码行数:14,代码来源:CloseReportRequest.php

示例10: authorize

 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     $reportId = $this->route('id');
     $report = ExpenseReport::findOrFail($reportId);
     if ($report->users()->get(['id'])->contains(\Auth::user()->id) || $report->owner_id == \Auth::user()->id) {
         return true;
     }
     return false;
 }
开发者ID:abada,项目名称:SettleUp-Laravel,代码行数:14,代码来源:ShowReportRequest.php

示例11: rules

 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     if (isset(\Auth::user()->site_id)) {
         $sites_ids = SiteLanguages::site_access()->select(\DB::raw(' GROUP_CONCAT(id) as sites_ids'))->groupBy('sites_id')->get();
         $site_access = 'in:' . $sites_ids[0]->sites_ids;
     } else {
         $site_access = '';
     }
     return ['sitelanguages_id' => 'required|' . $site_access, 'title' => 'required|unique:topmenus,title,' . $this->topmenus, 'link' => 'required'];
 }
开发者ID:AmirHome,项目名称:CMS_20160115,代码行数:15,代码来源:UpdateTopMenusRequest.php

示例12: rules

 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     if (isset(\Auth::user()->site_id)) {
         $sites_ids = SiteLanguages::site_access()->select(\DB::raw(' GROUP_CONCAT(id) as sites_ids'))->groupBy('sites_id')->get();
         $site_access = 'in:' . $sites_ids[0]->sites_ids;
     } else {
         $site_access = '';
     }
     return ['title' => 'required', 'slug' => 'required', 'text' => 'required', 'sitelanguages_id' => 'required|' . $site_access, 'meta_keywords' => 'required', 'meta_description' => 'required'];
 }
开发者ID:AmirHome,项目名称:CMS_20160115,代码行数:15,代码来源:UpdatePagesRequest.php

示例13: authorize

 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     $id = $this->route('id');
     if ($id == 0) {
         return TRUE;
     }
     $transactionItem = \App\TransactionItem::find($id);
     if (!$transactionItem) {
         return TRUE;
     }
     return \Auth::user()->owns($transactionItem->transaction->customer);
 }
开发者ID:aljogabot,项目名称:AmazonStats,代码行数:17,代码来源:TransactionItemSaveRequest.php

示例14: authorize

 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     switch ($this->method()) {
         case 'GET':
         case 'DELETE':
             return \Auth::user()->can('destroy home') ? true : null;
         case 'POST':
             return \Auth::user()->can('store home') ? true : null;
         case 'PUT':
         case 'PATCH':
             return \Auth::user()->can('update home') ? true : null;
         default:
             break;
     }
 }
开发者ID:karpuzkan,项目名称:laravel,代码行数:20,代码来源:AdminRequest.php

示例15: rules

 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     /**
      *  check security in frontend  site language for any users
      *
      * @return string
      */
     if (isset(\Auth::user()->site_id)) {
         $sites_ids = SiteLanguages::site_access()->select(\DB::raw(' GROUP_CONCAT(id) as sites_ids'))->groupBy('sites_id')->get();
         $site_access = 'in:' . $sites_ids[0]->sites_ids;
     } else {
         $site_access = '';
     }
     return ['sitelanguages_id' => 'required|' . $site_access, 'slug' => 'required|unique:news,slug', 'text' => 'required', 'meta_keywords' => 'required'];
 }
开发者ID:AmirHome,项目名称:CMS_20160115,代码行数:20,代码来源:CreateNewsRequest.php


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