/** * 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::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::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() { $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() { $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() { return \Auth::user()->can('manage_system'); }
/** * Determine if the user is authorized to make this request. * * @return bool */ public function authorize() { return !empty(Auth::user()) && Auth::user()->hasRole('administrator'); }
/** * Get the validation rules that apply to the request. * * @return array */ public function rules() { return ['username' => 'required|unique:users,username,' . \Auth::user()->id, 'email' => 'required|email|unique:users,email,' . \Auth::user()->id, 'phone' => 'required', 'name' => 'required', 'password' => 'min:6', 'photo' => 'image|image_size:<=300']; }
/** * Determine if the user is authorized to make this request. * * @return bool */ public function authorize() { if (\Auth::user()->isAdmin()) { return true; } }
/** * 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]; }
/** * @param Route $route */ public function __construct(Route $route) { $this->route = $route; $this->course = $route->getParameter('courses'); $this->user = \Auth::user()->id; }
/** * Get the validation rules that apply to the request. * * @return array */ public function rules() { return ['name' => 'required| unique:games,name,NULL,id,user_id,' . \Auth::user()->id, 'category_id' => 'required']; }
/** * Get the validation rules that apply to the request. * * @return array */ public function rules() { $user = \Auth::user(); return ['name' => 'required|max:255', 'email' => 'required|email|max:255|unique:users,email,' . $user->id, 'password' => 'required|confirmed|min:6']; }
/** * Determine if the user is authorized to make this request. * * @return bool */ public function authorize() { return \Auth::user()->isAdmin; }
/** * 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']; }
/** * Get the validation rules that apply to the request. * * @return array */ public function rules() { $grade = \Auth::user()->grades()->where('name', 'Lycée')->first()->name; return ['nom_enfant' => 'required|min:3', 'date_naissance' => 'required', 'photo' => 'image', 'nom_pere' => 'required|min:3', 'nom_mere' => 'required|min:3', 'email_responsable' => 'required|email', 'grade' => 'required|integer', 'cin' => 'required|alpha_num', 'classe' => 'required|integer']; }
/** * 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::user(); }