update
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\DomainFluctuation\App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Modules\DomainFluctuation\App\DTOs\DomainFluctuationTermDTO;
|
||||
|
||||
class StoreTermRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'term_name' => ['required', 'string', 'max:255'],
|
||||
'description' => ['nullable', 'string'],
|
||||
'date_create' => ['nullable'],
|
||||
'status' => ['nullable', 'boolean'],
|
||||
'type' => ['nullable', 'in:vnnic_06,vnnic_07'],
|
||||
];
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'term_name.required' => 'Tên đợt khai báo là bắt buộc',
|
||||
];
|
||||
}
|
||||
|
||||
public function toDTO(int $userId): DomainFluctuationTermDTO
|
||||
{
|
||||
return DomainFluctuationTermDTO::fromArray(array_merge(
|
||||
$this->validated(),
|
||||
['user_id' => $userId]
|
||||
));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user