/** * Handle the command. * @param object $command * @return void */ public function handle($command) { if ($hash = Shorten::exists($command->url)) { return $hash; } $hash = Shorten::generateHash(); $user_id = \Auth::user() ? \Auth::user()->id : 0; $link = $this->model->generate($user_id, $command->url, $hash); $this->dispatchEventsFor($link); $this->repository->save($link); return $hash; }
/** * Logged in User history page * GET /history * @return Response */ public function history() { $links = $this->linkRepository->getAllUserLinks(Auth::user()); return View::make('user.history', compact('links')); }