StoreTransactionRequest.php 815B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. namespace App\Http\Requests\Transaction;
  3. use App\Models\EntryTransaction;
  4. use Illuminate\Foundation\Http\FormRequest;
  5. use Illuminate\Validation\Rule;
  6. class StoreTransactionRequest extends FormRequest
  7. {
  8. /**
  9. * Determine if the user is authorized to make this request.
  10. *
  11. * @return bool
  12. */
  13. public function authorize()
  14. {
  15. return true;
  16. }
  17. /**
  18. * Get the validation rules that apply to the request.
  19. *
  20. * @return array<string, mixed>
  21. */
  22. public function rules()
  23. {
  24. return [
  25. 'plat_number' => 'required',
  26. 'entry_transaction_id' => [
  27. 'required',
  28. Rule::in(EntryTransaction::pluck('transaction_number')),
  29. ],
  30. 'type_vehicle_id' => 'required',
  31. ];
  32. }
  33. }