CompanyBenefitRequest.php 635 B

12345678910111213141516171819202122232425
  1. <?php
  2. namespace App\Http\Requests;
  3. use Illuminate\Foundation\Http\FormRequest;
  4. class CompanyBenefitRequest extends FormRequest
  5. {
  6. public function rules(): array
  7. {
  8. $rules = [
  9. 'title' => 'sometimes|string|max:255',
  10. 'icon' => 'sometimes|string|max:100',
  11. 'description' => 'sometimes|nullable|string|max:500',
  12. 'order' => 'sometimes|integer|min:0',
  13. ];
  14. if ($this->isMethod('post')) {
  15. $rules['title'] = 'required|string|max:255';
  16. $rules['icon'] = 'required|string|max:100';
  17. }
  18. return $rules;
  19. }
  20. }