• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Requests\Auth类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了Auth类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


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


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


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


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


示例20: authorize

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Requests\PostRequest类代码示例发布时间:2022-05-23
下一篇:
PHP Requests\ArticleRequest类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap