| Conditions | 5 |
| Paths | 6 |
| Total Lines | 18 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 24 | public function rules() |
||
| 25 | { |
||
| 26 | $id = $this->user->id ?? ''; |
||
| 27 | $rules = [ |
||
| 28 | 'name' => 'required|max:100', |
||
| 29 | 'email' => 'required|email|unique:users,email,'.$id, |
||
| 30 | ]; |
||
| 31 | if ($this->getMethod() == 'POST') { |
||
| 32 | $rules += ['password' => 'required|confirmed|min:8|max:30']; |
||
| 33 | } |
||
| 34 | |||
| 35 | if ($this->getMethod() == 'PATCH' || $this->getMethod() == 'PUT') { |
||
| 36 | if ($this->password) { |
||
| 37 | $rules += ['password' => 'required|confirmed|min:8|max:30']; |
||
| 38 | } |
||
| 39 | } |
||
| 40 | |||
| 41 | return $rules; |
||
| 42 | } |
||
| 44 |