32 lines
943 B
PHP
32 lines
943 B
PHP
<?php
|
|||
|
|
|
||
|
|
namespace App\Http\Requests;
|
||
|
|
|
||
|
|
use App\Models\Task;
|
||
|
|
use Illuminate\Foundation\Http\FormRequest;
|
||
|
|
use Illuminate\Validation\Rule;
|
||
|
|
|
||
|
|
class UpdateTaskRequest extends FormRequest
|
||
|
|
{
|
||
|
|
public function authorize(): bool
|
||
|
|
{
|
||
|
|
return true;
|
||
|
|
}
|
||
|
|
|
||
|
|
public function rules(): array
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
'title' => ['sometimes', 'string', 'max:255'],
|
||
|
|
'description' => ['nullable', 'string'],
|
||
|
|
'status' => ['sometimes', 'string', Rule::in(Task::STATUSES)],
|
||
|
|
'project_id' => ['sometimes', 'integer', 'exists:projects,id'],
|
||
|
|
'priority' => ['sometimes', 'integer', 'min:0', 'max:10'],
|
||
|
|
'due_at' => ['nullable', 'date'],
|
||
|
|
'started_at' => ['nullable', 'date'],
|
||
|
|
'completed_at' => ['nullable', 'date'],
|
||
|
|
'estimated_hours' => ['nullable', 'integer', 'min:0'],
|
||
|
|
'actual_hours' => ['nullable', 'integer', 'min:0'],
|
||
|
|
];
|
||
|
|
}
|
||
|
|
}
|