KanbanRequest.php 1011 B

1234567891011121314151617181920212223242526
  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. 'scope' => "{$sometimes}|string|in:internal,all,specific",
  15. 'responsible_user_id' => 'nullable|integer|exists:users,id',
  16. 'target_unit_id' => 'nullable|integer|exists:units,id',
  17. 'sector' => 'nullable|string|max:255',
  18. 'due_date' => 'nullable|date',
  19. 'description' => 'nullable|string',
  20. ];
  21. }
  22. }