/** * Handle the command. * * @param FavoriteProductCommand $command * @return void */ public function handle(FavoriteProductCommand $command) { $user = $this->userRepo->findById($command->userId); dd($user); $this->productRepo->favorite($command->productIdToFavorite, $user); return $user; }
/** * Remove the specified User from storage. * * @param int $id * * @return Response */ public function destroy($id) { $user = $this->userRepository->find($id); if (empty($user)) { $this->throwRecordNotFoundException("User not found", ERROR_CODE_RECORD_NOT_FOUND); } $user = $this->userRepository->delete($id); $meta = array('total' => count($user), 'count' => count($user), 'offset' => 0, 'last_updated' => $this->userRepository->lastUpdated(), 'status' => "User deleted successfully.", 'error' => 'Success'); return Response::json(ResponseManager::makeResult($id, $meta)); }
/** * Remove the specified User from storage. * * @param int $id * * @return Response */ public function destroy($id) { $user = $this->userRepository->find($id); if (empty($user)) { Flash::error('User not found'); return redirect(route('users.index')); } $this->userRepository->delete($id); Flash::success('User deleted successfully.'); return redirect(route('users.index')); }
/** * Remove the specified User from storage. * @param int $id * @return Response */ public function destroy($id) { if (!AuthcheckController::checkAuth(Sentinel::forceCheck(), ['user.delete'], 'Usuarios', 'excluir')) { return redirect()->back(); } else { $user = $this->userRepository->find($id); if (empty($user)) { Flash::error('User not found'); return redirect(route('users.index')); } $this->userRepository->delete($id); Flash::success('User deleted successfully.'); return redirect(route('users.index')); } }
/** * Handle the command. * * @param UnfavoriteProductCommand $command * @return void */ public function handle(UnfavoriteProductCommand $command) { $user = $this->userRepo->findById($command->userId); $this->productRepo->unFavorite($command->userIdToUnfollow, $user); return $user; }
/** * Remove the specified User from storage. * DELETE /users/{id} * * @param int $id * * @return Response */ public function destroy($id) { $this->userRepository->apiDeleteOrFail($id); return $this->sendResponse($id, "User deleted successfully"); }
/** * Handle the command. * * @param UnfollowUserCommand $command * @return void */ public function handle(UnfollowUserCommand $command) { $user = $this->userRepo->findById($command->userId); $this->userRepo->unfollow($command->userIdToUnfollow, $user); }
/** * Handle the command. * * @param FollowUserCommand $command * @return void */ public function handle(FollowUserCommand $command) { $user = $this->userRepo->findById($command->userId); $this->userRepo->follow($command->userIdToFollow, $user); return $user; }
/** * Display a listing of the resource. * * @return Response */ public function index() { $users = $this->userRepository->getPaginated(); return view('site.users.index')->with('users', $users); }