KanbanRequest.php 1.0 KB

123456789101112131415161718192021222324252627
  1. <?php
  2. namespace App\Http\Requests;
  3. use Illuminate\Foundation\Http\FormRequest;
  4. class KanbanRequest extends FormRequest
  5. {
  6. public function rules(): array
  7. {
  8. $isUpdate = $this->isMethod('PUT') || $this->isMethod('PATCH');
  9. $sometimes = $isUpdate ? 'sometimes' : 'required';
  10. return [
  11. 'title' => "{$sometimes}|string|max:255",
  12. 'priority' => "{$sometimes}|string|in:alta,normal,baixa",
  13. 'phase' => "{$sometimes}|string|in:a_fazer,em_progresso,em_revisao,concluido,demandas_especiais",
  14. 'order' => 'sometimes|integer|min:0',
  15. 'scope' => "{$sometimes}|string|in:internal,all,specific",
  16. 'responsible_user_id' => 'nullable|integer|exists:users,id',
  17. 'target_unit_id' => 'nullable|integer|exists:units,id',
  18. 'sector' => 'nullable|string|max:255',
  19. 'due_date' => 'nullable|date',
  20. 'description' => 'nullable|string',
  21. ];
  22. }
  23. }