getAfterIngest($id); if ($result['status'] !== 'processing') { // $handler->destroy($id); } return response()->json($result, 200); } catch (\Exception $exception) { return response()->json([ 'message' => $exception->getMessage(), ], 400); } } public function store() { request()->validate([ 'content' => 'required', // String or file. 'searchers' => 'required|array', 'searchers.*.key' => 'required', 'searchers.*.type' => 'required|in:replace,displace', 'searchers.*.vale' => 'nullable', 'searchOnly' => 'nullable|boolean' ]); $searchOnly = request()->input('searchOnly') ?? false; $searchAndDisplace = new SearchAndDisplace( request()->input('content'), [ 'searchers' => request()->input('searchers'), ], $searchOnly ); try { return response()->json($searchAndDisplace->execute(), 200); } catch (\Exception $exception) { return response()->json([ 'message' => $exception->getMessage(), 'trace' => $exception->getTrace(), ], 400); } } }