/** * 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(); }
/** * 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; }
/** * Determine if the user is authorized to make this request. * * @return bool */ public function authorize() { if (\Auth::check()) { return true; } return false; }
public function authorize() { // Only allow logged in users return \Auth::check(); // Allows all users in // return true; }
/** * Determine if the user is authorized to make this request. * * @return bool */ public function authorize() { if (\Auth::user()->isModerator()) { return true; } return false; }
/** * 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)); }
/** * Determine if the user is authorized to make this request. * * @return bool */ public function authorize() { if (\Auth::guest()) { return false; } else { return true; } }
/** * 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; } }
/** * 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; }
/** * 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; }
/** * 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; } }
/** * 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(); }
/** * 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; }
/** * 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; }
/** * 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']; }
/** * 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']; }
/** * 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); }
/** * 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; } }
/** * 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']; }
/** * 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; } }
/** * Determine if the user is authorized to make this request. * * @return bool */ public function authorize() { $reportId = $this->route('reportId'); if ($reportId == null) { $expenseId = $this->route('expenseId'); $reportId = Expense::find($expenseId)->report_id; } $report = ExpenseReport::find($reportId); if ($report->status) { return false; } if ($report->users()->get(['id'])->contains(\Auth::user()->id) || $report->owner_id == \Auth::user()->id) { return true; } return false; }
/** * 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; }
/** * 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']; } }
/** * Determine if the user is authorized to make this request. * * @return bool */ public function authorize() { return (bool) (!\Auth::user()->team_id); }
/** * Determine if the user is authorized to make this request. * * @return bool */ public function authorize() { return \Auth::check(); }
/** * Get the validation rules that apply to the request. * * @return array */ public function rules() { $site_access = isset(\Auth::user()->site_id) ? '|in:' . \Auth::user()->site_id : ''; return ['sites_id' => 'required|exists:sites,id' . $site_access . '|unique_with:sitelanguages,languages_id', 'languages_id' => 'required|exists:languages,id']; }
/** * Determine if the user is authorized to make this request * * @return bool */ public function authorize() { return Auth::guest(); }
/** * Determine if the user is authorized to make this request. * * @return bool */ public function authorize() { return \Auth::user()->isAdmin; }
/** * Determine if the user is authorized to make this request. * * @return bool */ public function authorize() { return \Auth::user()->can('manage_system'); }
/** * Determine if the user is authorized to make this request. * * @return bool */ public function authorize() { // only allow updates if the user is logged in return \Auth::check(); }