當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Requests\Auth類代碼示例

本文整理匯總了PHP中App\Http\Requests\Auth的典型用法代碼示例。如果您正苦於以下問題:PHP Auth類的具體用法?PHP Auth怎麽用?PHP Auth使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Auth類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: authorize

 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     if ($this->isUpdate()) {
         return Post::findOrFail($this->get('id'))->user_id == \Auth::id();
     }
     return \Auth::check();
 }
開發者ID:spitzgoby,項目名稱:spitzgoby,代碼行數:12,代碼來源:PostRequest.php

示例2: 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

示例3: authorize

 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     if (\Auth::check()) {
         return true;
     }
     return false;
 }
開發者ID:abada,項目名稱:webshop,代碼行數:12,代碼來源:SendTestRequest.php

示例4: authorize

 public function authorize()
 {
     // Only allow logged in users
     return \Auth::check();
     // Allows all users in
     // return true;
 }
開發者ID:andreea-bucur,項目名稱:GuestBook,代碼行數:7,代碼來源:Request.php

示例5: 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

示例6: 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

示例7: authorize

 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     if (\Auth::guest()) {
         return false;
     } else {
         return true;
     }
 }
開發者ID:aboustayyef,項目名稱:deprecated_lb_l5,代碼行數:13,代碼來源:AdminSourcesRequest.php

示例8: 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

示例9: 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

示例10: 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

示例11: 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

示例12: 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

示例13: 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

示例14: 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

示例15: 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


注:本文中的App\Http\Requests\Auth類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。