本文整理汇总了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();
}
示例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;
}
示例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;
}
示例5: authorize
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return User::where('id', \Auth::id())->exists();
}
示例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'];
}
示例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();
}