Last change
on this file since 7ed1069 was d25ba66, checked in by Özkan İliyaz <iliyaz_96@…>, 4 years ago |
ADD post confirmation with multiple phases, notification after succesfully password creation
|
-
Property mode
set to
100644
|
File size:
1.1 KB
|
Line | |
---|
1 | <?php
|
---|
2 |
|
---|
3 | namespace App\Http\Requests\Dashboard;
|
---|
4 |
|
---|
5 | use Illuminate\Foundation\Http\FormRequest;
|
---|
6 |
|
---|
7 | class PhaseRequest extends FormRequest
|
---|
8 | {
|
---|
9 | /**
|
---|
10 | * Determine if the user is authorized to make this request.
|
---|
11 | *
|
---|
12 | * @return bool
|
---|
13 | */
|
---|
14 | public function authorize()
|
---|
15 | {
|
---|
16 | if ($this->has("phase_id") && !is_null($this->request->get("phase_id"))) {
|
---|
17 | return auth()->user()->hasPermission("edit_phase");
|
---|
18 | }
|
---|
19 |
|
---|
20 | return auth()->user()->hasPermission("create_phase");
|
---|
21 | }
|
---|
22 |
|
---|
23 | /**
|
---|
24 | * Get the validation rules that apply to the request.
|
---|
25 | *
|
---|
26 | * @return array
|
---|
27 | */
|
---|
28 | public function rules()
|
---|
29 | {
|
---|
30 | $rules = [
|
---|
31 | "name" => "required|min:2|unique:phases",
|
---|
32 | "reviewer_role_id" => "required|exists:roles,id",
|
---|
33 | ];
|
---|
34 |
|
---|
35 | if ($this->has("phase_id") && !is_null($this->request->get("phase_id"))) {
|
---|
36 | $rules["name"] = "required|min:2|unique:phases,name," . $this->request->get("phase_id");
|
---|
37 | $rules["phase_id"] = "required|exists:phases,id";
|
---|
38 | }
|
---|
39 |
|
---|
40 | return $rules;
|
---|
41 | }
|
---|
42 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.