'Fetch Voucher', 'message' => 'You have successfully fetched a voucher' ]; } /** @var ValidatesVoucherifyVoucher */ private $validatesVoucherifyVoucher; /** * ValidateVoucherLogic constructor. * @param ValidatesVoucherifyVoucher $validatesVoucherifyVoucher */ public function __construct(ValidatesVoucherifyVoucher $validatesVoucherifyVoucher) { $this->validatesVoucherifyVoucher = $validatesVoucherifyVoucher; } /** * @param Request $request * @return JsonResponse * @throws MalformedRequestException */ public function logic(Request $request) : JsonResponse { $booking = Booking::find($request->input('itemId')); $employee = $booking->company->employees()->first(); $validateVoucherifyVoucherObject = new ValidateVoucherifyVoucherObject($booking->company_id, $request->input('voucherCode'), $request->input('amount'), $employee); $result = $this->validatesVoucherifyVoucher->execute($validateVoucherifyVoucherObject); return $this->response(['data' => $result]); } }