UnitHistoryRequest.php 562 B

1234567891011121314151617181920
  1. <?php
  2. namespace App\Http\Requests;
  3. use Illuminate\Foundation\Http\FormRequest;
  4. class UnitHistoryRequest extends FormRequest
  5. {
  6. public function rules(): array
  7. {
  8. $isUpdate = $this->isMethod('PUT') || $this->isMethod('PATCH');
  9. return [
  10. 'unit_id' => ($isUpdate ? 'sometimes|' : 'required|') . 'integer|exists:units,id',
  11. 'title' => 'required|string|max:255',
  12. 'content' => 'nullable|string',
  13. 'visible_to_franchisee' => 'boolean',
  14. ];
  15. }
  16. }