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


PHP Auth::id方法代码示例

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


在下文中一共展示了Auth::id方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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()
 {
     // User Model:
     $user = $this->route('users');
     // Post Model:
     $post = $this->route('posts');
     // Ensure Authenticated User is trying to create/edit their own post
     if ($user->id === \Auth::id()) {
         // If a Post exists it means User is trying to edit a Post
         if ($post) {
             // Is the Authenticated User the owner of the Post they are trying to edit?
             // NB: $user and Auth::user() are the same thing as per the initial 'if' check
             return $post->owner->id === $user->id;
         } else {
             // Authenticated User is creating a New Post
             return true;
         }
     }
     return false;
 }
开发者ID:boxtar,项目名称:laratest,代码行数:25,代码来源:PostRequest.php

示例3: rules

 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     $postulante = Postulante::where('user_id', \Auth::id())->first();
     $email_personal = "";
     $email_institucional = "";
     $titulo_profesional = "";
     $numero = "";
     if ($postulante) {
         //dd('existe');
         $email_personal = "," . $postulante->id;
         $numero = "," . $postulante->id;
         $email_institucional = "," . $postulante->id . ',postulante';
     }
     if ($this->get('tipo_estudio') === 'Postgrado') {
         $titulo_profesional = 'required';
     }
     if ($this->get('procedencia') === 'UACH' and $this->get('tipo_estudio') === 'Pregrado') {
         return ['apellido_paterno' => 'required', 'apellido_materno' => 'required', 'nombre' => 'required', 'tipo' => 'required', 'numero' => 'required|unique:documento_identidad,numero' . $numero, 'fecha_nacimiento' => 'required', 'sexo' => 'required', 'email_personal' => 'required|unique:postulante,email_personal' . $email_personal, 'telefono' => 'required', 'ciudad' => 'required', 'direccion' => 'required', 'nacionalidad' => 'required', 'como_se_entero' => 'required', 'nivel_de_español' => 'required', 'lugar_nacimiento' => 'required', 'titulo_profesional' => $titulo_profesional, 'tipo_estudio' => 'required', 'procedencia' => 'required', 'email_institucional' => 'required|unique:pre_uach,email_institucional' . $email_institucional, 'grupo_sanguineo' => 'required', 'telefono_2' => 'required', 'ciudad_2' => 'required', 'direccion_2' => 'required'];
     } else {
         return ['apellido_paterno' => 'required', 'apellido_materno' => 'required', 'nombre' => 'required', 'tipo' => 'required', 'numero' => 'required|unique:documento_identidad,numero' . $numero, 'fecha_nacimiento' => 'required', 'sexo' => 'required', 'email_personal' => 'required|unique:postulante,email_personal' . $email_personal, 'telefono' => 'required', 'ciudad' => 'required', 'direccion' => 'required', 'nacionalidad' => 'required', 'como_se_entero' => 'required', 'nivel_de_español' => 'required', 'lugar_nacimiento' => 'required', 'titulo_profesional' => $titulo_profesional, 'tipo_estudio' => 'required', 'procedencia' => 'required'];
     }
 }
开发者ID:elNapoli,项目名称:iCnca7CrTNYXRF4oxPSidusv17MoVk7CEAhNGFGcYHSu0DNSy7Hkq,代码行数:27,代码来源:CretePostulacionRequest.php

示例4: authorize

 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     return \Auth::id() === $this->route('users')->id;
 }
开发者ID:boxtar,项目名称:laratest,代码行数:9,代码来源:UserRequest.php

示例5: authorize

 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     return User::where('id', \Auth::id())->exists();
 }
开发者ID:WangWeigao,项目名称:m1,代码行数:9,代码来源:StoreInstrumentPostRequest.php

示例6: rules

 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     return ['first_name' => 'required|max:100', 'last_name' => 'required|max:100', 'email' => 'required|max:255|email|unique:user,email,' . \Auth::id(), 'gender' => 'required|in:female,male', 'birthdate_submit' => 'required|date', 'phone' => 'max:15'];
 }
开发者ID:charlieboo,项目名称:creatrip,代码行数:9,代码来源:UpdateAccountRequest.php

示例7: authorize

 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     $id = $this->route('id');
     return Comment::where('id', $id)->where('user_id', \Auth::id())->exists();
 }
开发者ID:TyrekeYang,项目名称:webapp,代码行数:10,代码来源:PostRequest.php


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