createOrder = $createOrder; } /** * @param int $companyId * @param Request $request * @return \App\Models\Order|null * @throws InternalServerErrorException */ public function execute(int $companyId, Request $request) { try { $order = new OrderObject($request->input('marking'), $companyId); return $this->createOrder->execute($order); } catch (CannotCreateOrderException $exception){ throw new InternalServerErrorException("Failed to create order because {$exception->getMessage()}"); } } }