/ app / Http / Requests / GetAllCertificates.php
GetAllCertificates.php
 1  <?php
 2  
 3  namespace App\Http\Requests;
 4  
 5  use App\Exceptions\EnisaValidationApiException;
 6  use Illuminate\Contracts\Validation\Validator;
 7  use Illuminate\Foundation\Http\FormRequest;
 8  
 9  class GetAllCertificates extends FormRequest
10  {
11      /**
12       * Determine if the user is authorized to make this request.
13       *
14       * @return bool
15       */
16      public function authorize(): bool
17      {
18          return true;
19      }
20  
21      /**
22       * Get the validation rules that apply to the request.
23       *
24       * @return array<string, mixed>
25       */
26      public function rules(): array
27      {
28          return [
29              'last_ts' => 'date_format:Y-m-d H:i:s',
30          ];
31      }
32  
33      public function messages(): array
34      {
35          return [
36              'last_ts' => 'Invalid parameter: last_ts',
37          ];
38      }
39  
40      protected function failedValidation(Validator $validator): void
41      {
42          throw new EnisaValidationApiException($validator);
43      }
44  }