public function postUpload(Request $request) { $file = $request->file('file'); $token = $request->getSession()->get('access_token'); if ($file->isValid()) { $uploadedFile = $this->imageRepository->create($file, $request->user()); $this->dispatch(new PerformOcr($uploadedFile, $token)); return json_encode(['status' => 'success']); } return json_encode(['status' => 'failed']); }
public function getIndex(Request $request) { $user = $request->user(); $images = $user ? $this->imageRepository->getByUser($user) : []; return view('index', ['user' => $user, 'images' => $images]); }