'Create Voucher', 'message' => 'You have successfully created a voucher' ]; } /** @var CreateVoucherProcessor */ private $createVoucherProcessor; /** * CreateVoucherLogic constructor. * @param CreateVoucherProcessor $createVoucherProcessor */ public function __construct(CreateVoucherProcessor $createVoucherProcessor) { $this->createVoucherProcessor = $createVoucherProcessor; } /** * @param Request $request * @return JsonResponse * @throws MalformedRequestException */ public function logic(Request $request) : JsonResponse { $user = User::where('id', $request->input('userId'))->first(); $result = $this->createVoucherProcessor->execute($user, $request->input('voucherCode'), null); return $this->response(['data' => $result]); } }