Passed
Pull Request — master (#7)
by Koen
04:19
created

IndexRequest::rules()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 6
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 8
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Http\Requests\Api\User;
6
7
use Illuminate\Foundation\Http\FormRequest;
8
9
final class IndexRequest extends FormRequest
10
{
11
    /**
12
     * Determine if the user is authorized to make this request.
13
     *
14
     * @return bool
15
     */
16 7
    public function authorize(): bool
17
    {
18 7
        return true;
19
    }
20
21
    /**
22
     * Get the validation rules that apply to the request.
23
     *
24
     * @return array
25
     */
26 7
    public function rules(): array
27
    {
28
        return [
29 7
            'name'    => ['sometimes', 'string', 'max:191'],
30
            'email'   => ['sometimes', 'string', 'max:191'],
31
            'sortBy'  => ['sometimes', 'string', 'in:name,email'],
32
            'desc'    => ['sometimes', 'boolean'],
33
            'perPage' => ['sometimes', 'integer', 'min:1', 'max:100'],
34
        ];
35
    }
36
}
37