public function getProfile(Rank $rank, Country $country) { $data = ['reviewer' => false, 'ranks' => $rank->getRanks(), 'countries' => $country->getCountries(), 'categories' => getNomenclatureSelect($this->getCategories())]; $settings = $this->getDepartment()->settings()->key('user_data'); $disabled = ''; if (isset($settings->value) && $settings->value) { session()->put('warning', 'lock-data'); $disabled = 'disabled'; } if (auth()->user()->is_reviewer || systemAccess(2)) { $data['reviewer'] = true; $data['selectedCategories'] = auth()->user()->categories()->lists('id')->toArray(); } $data['disabled'] = $disabled; return view('conference.profile', $data); }
/** * Get the validation rules that apply to the request. * @param Rank $rank * @param Country $country * @return array */ public function rules(Rank $rank, Country $country) { $userId = $this->request->has('user_id') ? $this->request->get('user_id') : null; $department = $this->request->has('department_id') ? $this->request->get('department_id') : auth()->user()->department_id; return ['rank_id' => 'in:' . implode(',', array_keys($rank->getRanks())), 'name' => 'required|max:255|min:4', 'phone' => 'max:30|min:5|regex:' . config('auth.expressions.phone'), 'address' => 'required|max:255|min:4', 'institution' => 'required|max:100|min:4', 'country_id' => 'required|in:' . implode(',', array_keys($country->getCountries())), 'user_type_id' => 'required|exists:user_type,id', 'email' => 'required|email|max:255|unique:users,email,' . $userId . ',id,department_id,' . $department, 'email2' => 'email|max:255', 'password' => $userId ? 'confirmed|min:6' : 'required|confirmed|min:6', 'categories' => 'exists:category,id']; }
/** * Get the validation rules that apply to the request. * @rank * @country * @return array */ public function rules(Rank $rank, Country $country) { return ['rank_id' => 'in:' . implode(',', array_keys($rank->getRanks())), 'name' => 'required|max:255|min:4', 'phone' => 'max:30|min:5|regex:' . config('auth.expressions.phone'), 'address' => 'required|max:255|min:4', 'institution' => 'required|max:100|min:4', 'country_id' => 'required|in:' . implode(',', array_keys($country->getCountries())), 'categories' => auth()->user()->is_reviewer ? 'required|exists:category,id' : '']; }
/** * Show the form for editing the specified resource. * * @param User $user * @param \App\Classes\Rank $rank, * @param \App\Classes\Country $country, * @return \Illuminate\Http\Response */ public function edit(User $user, Rank $rank, Country $country) { $user->load('categories'); return view('admin.user.edit', ['user' => $user, 'ranks' => $rank->getRanks(), 'countries' => $country->getCountries(), 'reviewer' => 1, 'selectedCategories' => $user->categories->lists('id')->toArray(), 'categories' => getNomenclatureSelect($this->getCategories($user->department_id))]); }
public function getRegister(Rank $rank, Country $country) { $lock = $this->getDepartment()->settings()->key('registrations'); if (isset($lock->value) && $lock->value) { return redirect()->back()->with('error', 'lock-registrations'); } return view('auth.register', ['ranks' => $rank->getRanks(), 'countries' => $country->getCountries(), 'categories' => getNomenclatureSelect($this->getCategories())]); }