1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Sfneal\Tracking\Requests; |
4
|
|
|
|
5
|
|
|
use Illuminate\Foundation\Http\FormRequest; |
6
|
|
|
|
7
|
|
|
// todo: add to controllers package? |
8
|
|
|
class TrackRequest extends FormRequest |
9
|
|
|
{ |
10
|
|
|
/** |
11
|
|
|
* TrackRequest constructor. |
12
|
|
|
* |
13
|
|
|
* @param array $query The GET parameters |
14
|
|
|
* @param array $request The POST parameters |
15
|
|
|
* @param array $attributes The request attributes (parameters parsed from the PATH_INFO, ...) |
16
|
|
|
* @param array $cookies The COOKIE parameters |
17
|
|
|
* @param array $files The FILES parameters |
18
|
|
|
* @param array $server The SERVER parameters |
19
|
|
|
* @param string|resource|null $content The raw body data |
20
|
|
|
*/ |
21
|
|
|
public function __construct(array $query = [], array $request = [], array $attributes = [], array $cookies = [], array $files = [], array $server = [], $content = null) |
22
|
|
|
{ |
23
|
|
|
parent::__construct($query, $request, $attributes, $cookies, $files, $server, $content); |
24
|
|
|
|
25
|
|
|
// Set container |
26
|
|
|
$this->setContainer(app()); |
27
|
|
|
|
28
|
|
|
// Get validator instance |
29
|
|
|
$this->getValidatorInstance(); |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Determine if the user is authorized to make this request. |
34
|
|
|
* |
35
|
|
|
* @return bool |
36
|
|
|
*/ |
37
|
|
|
public function authorize(): bool |
38
|
|
|
{ |
39
|
|
|
return true; |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* Get the validation rules that apply to the request. |
44
|
|
|
* |
45
|
|
|
* @return array |
46
|
|
|
*/ |
47
|
|
|
public function rules(): array |
48
|
|
|
{ |
49
|
|
|
return [ |
50
|
|
|
'table' => ['string', 'nullable'], |
51
|
|
|
'user' => ['integer', 'nullable'], |
52
|
|
|
'users' => ['array', 'nullable'], |
53
|
|
|
'key' => ['integer', 'nullable'], |
54
|
|
|
'period' => ['array', 'nullable'], |
55
|
|
|
]; |
56
|
|
|
} |
57
|
|
|
} |
58
|
|
|
|