-
Notifications
You must be signed in to change notification settings - Fork 0
/
UpdateCreditCardRequest.php
43 lines (38 loc) · 1.23 KB
/
UpdateCreditCardRequest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
namespace App\API\CreditCard\v1;
use Illuminate\Foundation\Http\FormRequest;
class UpdateCreditCardRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return $this->user()->can('update', $this->creditCard);
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array|string>
*/
public function rules(): array
{
return [
'name' => 'sometimes|required|string|max:255',
'due_date' => 'sometimes|required|integer|min:1|max:28',
'closing_date' => 'sometimes|required|integer|min:1|max:28',
'interest_rate' => 'sometimes|nullable|decimal:0,2|min:0|max:200',
'limit' => 'sometimes|required|decimal:0,4|min:0',
];
}
public function attributes(): array
{
return [
'name' => __('labels.name'),
'due_date' => __('labels.due_date'),
'closing_date' => __('labels.closing_date'),
'interest_rate' => __('labels.interest_rate'),
'limit' => __('labels.limit'),
];
}
}