<?php
 namespace App\Http\Requests\Store; use Illuminate\Contracts\Validation\Validator; use Illuminate\Foundation\Http\FormRequest; use Illuminate\Http\Exceptions\HttpResponseException; class BasketApplyCouponRequest extends FormRequest { public function authorize(): bool { return true; } public function rules(): array { return [ 'coupon_code' => ['required', 'string', 'max:255'], ]; } protected function failedValidation(Validator $validator): void { throw new HttpResponseException(response()->json([ 'success' => false, 'message' => $validator->errors()->first() ?: __('store.general_error'), 'errors' => $validator->errors(), ], 422)); } } 