Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 16 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| ShortcutCategoryPositionFormRequest | |
0.00% |
0 / 16 |
|
0.00% |
0 / 2 |
20 | |
0.00% |
0 / 1 |
| authorize | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| rules | |
0.00% |
0 / 15 |
|
0.00% |
0 / 1 |
12 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * Created by PhpStorm. |
| 4 | * User: prathmesh |
| 5 | * Date: 3/10/20 |
| 6 | * Time: 12:04 PM |
| 7 | */ |
| 8 | |
| 9 | namespace App\Http\Requests; |
| 10 | |
| 11 | use Illuminate\Foundation\Http\FormRequest; |
| 12 | |
| 13 | class ShortcutCategoryPositionFormRequest extends FormRequest |
| 14 | { |
| 15 | public function authorize(): bool |
| 16 | { |
| 17 | return true; |
| 18 | } |
| 19 | |
| 20 | public function rules(): array |
| 21 | { |
| 22 | $rules = []; |
| 23 | switch ($this->method()) { |
| 24 | case 'POST': |
| 25 | $rules = [ |
| 26 | 'user_id' => 'required|string', |
| 27 | 'positions' => 'sometimes|array', |
| 28 | |
| 29 | ]; |
| 30 | break; |
| 31 | |
| 32 | case 'PUT': |
| 33 | $rules = [ |
| 34 | 'user_id' => 'sometimes|string', |
| 35 | 'positions' => 'sometimes|array', |
| 36 | |
| 37 | ]; |
| 38 | break; |
| 39 | } |
| 40 | |
| 41 | return $rules; |
| 42 | } |
| 43 | } |