Display the specified resource.

@param        \Illuminate\Http\Request  $request
@param    int  $id
@return  \Illuminate\Http\Response
970052
public function show($id,Request $request)
    {
        if($request->ajax())
        {
            return URL::to('feature/'.$id);
        }

        $feature = Feature::findOrfail($id);
        return view('unstarter.feature.show',compact('feature'));
    }
33829
public function update(Request $request, $id)
    {
        /** @noinspection PhpUndefinedMethodInspection */
        $request->validate(["content" => "required|max:1024"]);
        $note = Note::findOrFail($id);
        $note->content = $request->get("content");
        $this->authorize('manage', $note);
        $note->save();
        return fractal($note, new NoteTransformer())
            ->withResourceName('note')
            ->respond();

    }
647988
public function show($id, Request $request)
    {
        $entity = $this->getEntityById($id);

        if (!$entity) {
            return $this->response(null, Response::HTTP_NOT_FOUND);
        }

        return $this->response($this->serialize($entity, $request), Response::HTTP_OK);
    }
1065238
public function deleteAction($id, Request $request)
    {
        $data = $this->resolveData($id);
        $title = $this->resolveDataTitle($data);

        $breadcrumbs = $this->buildBreadcrumbs($this->getType());
        $breadcrumbs->addItem(sprintf('Delete "%s"', $this->resolveDataTitle($data)));

        $form = $this->createForm(DeleteFormType::class, array(
            'id' => $data->getId(),
            'title' => $title,
        ));

        $form->handleRequest($request);

        if ($form->isValid()) {
            if ($form->get('tabs')->get('actions')->get('delete')->isClicked()) {
                $manager = $this->getDoctrine()->getManager();
                $manager->remove($data);
                $manager->flush();

                $request->getSession()
                    ->getFlashBag()
                    ->add('success', sprintf('You deleted "%s"!', $title));
            }

            if ($request->query->has('_return')) {
                $redirectUrl = $this->generateUrl($request->query->get('_return'));
            } else {
                $redirectUrl = $this->getListUrl();
            }

            return $this->redirect($redirectUrl);
        }

        $module = $this->getModule($this->getType());

        return $this->render('ClasticNodeBundle:Backoffice/Node:form.html.twig', array(
            'page_title' => sprintf('Delete "%s"?', $title),
            'form' => $form->createView(),
            'module' => $module,
            'submodules' => $this->getSubmodules($module),
        ));
    }
217917
public function editAction(Request $request, $id)
    {
        /** @var ConfiguratorFactory $configuratorFactory */
        $configuratorFactory = $this->getConfiguratorFactory($this->getClassName());
        /** @var CrudConfigurator $crudConfigurator */
        $crudConfigurator = $configuratorFactory->getConfigurator(CrudConfigurator::class);

        $this->isGrantedOr404Error($crudConfigurator, Constants::ACTION_UPDATE);

        $model = $this->findOr404Error($id);
        $form = $crudConfigurator->getForm($model);

        return $this->createOrUpdate($request, $model, $form, Constants::ACTION_UPDATE, $crudConfigurator->getTemplate()->getEdit());
    }
1143954
public function showEdit(int $id = null, array $request = [])
    {
        if ($id === null) {
            if (isset($_GET['template']) === false) {
                return redirect($this->router->generate('users-list-page') . "?m=2");
            } else {
                return 'Redirect: ' . $this->router->generate('users-list-page') . "?m=2";
            }
        } elseif ($id === $this->core->auth()->details->id) {
            if (isset($_GET['template']) === false) {
                return redirect($this->router->generate('users-list-page') . "?m=3");
            } else {
                return 'Redirect: ' . $this->router->generate('users-list-page') . "?m=3";
            }
        }
        $user = $this->core->api('User/' . $id, 'GET')->run();
        if ($user['headers'][0][2] === 422) {
            if (isset($_GET['template']) === false) {
                return redirect($this->router->generate('users-list-page') . "?m=2");
            } else {
                return 'Redirect: ' . $this->router->generate('users-list-page') . "?m=2";
            }
        } elseif (($user["headers"][0][2] - 200) * ($user["headers"][0][2] - 299) > 0) {
            if (headers_sent() === false) {
                foreach ($user["headers"] as $header) {
                    header($header[0], $header[1], $header[2]);
                }
            }
            return $this->templates->render("500", [
                "error" => $user['response'],
                "result" => ''
            ]);
        }
        $roles_list = $this->core->api('Role/all', 'GET')->run();

        $messages = [
            'error' => '',
            'info' => '',
            'success' => '',
            'warning' => ''
        ];
        if (empty($request['m']) === false) {
            if ($request['m'] == 1) {
                $messages['success'] = 'User registered successfully.';
            } elseif ($request['m'] == 2) {
                if (headers_sent() === false) {
                    header('X-PHP-Response-Code: 202', true, 202);
                }
                $messages['success'] = 'User sessions invalidated successfully.';
            }
        }

        return $this->templates->render("Main::Users/Edit", [
            "messages" => $messages,
            "user" => $user['response'],
            "roles" => $roles_list['response']
        ]);
    }
809992
public function getAction(Request $request, $id)
    {
        $document = $this->getModel()->getSerialised($id, $request);

        $response = $this->getResponse()
            ->setStatusCode(Response::HTTP_OK)
            ->setContent($document);

        return $response;
    }
1304802
public function editPageSettingsAction(Request $request, $id)
	{
		/** @var PageInterface $page */
		$page = $this->admin->getObject($id);

		$layoutBlocks = $page->getLayoutBlock();

		$form = $this->admin->getForm();
		$form->setData($page);

		$form->handleRequest($request);

		$response = new Response();

		if($form->isSubmitted()){
			if($form->isValid()){
				$page->setStatus(PageInterface::STATUS_DRAFT);
				$page->setUpdatedAt();
				$page->setLayoutBlock($layoutBlocks);
				$this->admin->update($page);

				return $this->getAjaxEditResponse($form, $page);

			}
			$response->setStatusCode(422);
		}
		$view = $form->createView();
		$this->setFormTheme($view, $this->admin->getFormTheme());

		return $this->renderWithExtraParams(
			'@NetworkingInitCms/PageAdmin/page_settings_edit.html.twig',
			[
				'form' => $view,
                'object' => $page,
			],
			$response
		);
	}
1181464
public function update(Request $request, $id)
    {
        $entry = $this->entriesRepository->getById($id, $this->resource);
        $this->validate($request, $this->validationRules($this->resource, $entry));

        $this->entriesRepository->update($id, $request, $this->resource);

        return redirect()->back()->with('success', 'Updated');
    }
31031
public function update(Request $request, $id)
    {
        $this->model = $this->model->findOrFail($id);

        $request = $this->processRequest($request);

        if ($request === true) {
            return $this->redirection();
        }

        $this->validate($request, $this->model->rules());

        $this->model->update($request->all());

        $saved = $this->afterSaving($request);

        if ($saved) {
            return $this->redirection();
        }
    }
1245185
public function getAction($id, Request $request)
    {
        if ($this->getBooleanRequestParameter($request, 'tree', false, false)) {
            $collections = $this->getCollectionManager()->getTreeById(
                $id,
                $this->getRequestParameter($request, 'locale', true)
            );

            return $this->handleView(
                $this->view(
                    new CollectionRepresentation($collections, 'collections')
                )
            );
        }

        try {
            $locale = $this->getRequestParameter($request, 'locale', true);
            $depth = intval($request->get('depth', 0));
            $breadcrumb = $this->getBooleanRequestParameter($request, 'breadcrumb', false, false);
            $children = $this->getBooleanRequestParameter($request, 'children', false, false);
            $collectionManager = $this->getCollectionManager();

            // filter children
            $listRestHelper = $this->get('sulu_core.list_rest_helper');
            $limit = $request->get('limit', null);
            $offset = $this->getOffset($request, $limit);
            $search = $listRestHelper->getSearchPattern();
            $sortBy = $request->get('sortBy');
            $sortOrder = $request->get('sortOrder', 'ASC');

            $filter = [
                'limit' => $limit,
                'offset' => $offset,
                'search' => $search,
            ];

            $view = $this->responseGetById(
                $id,
                function($id) use ($locale, $collectionManager, $depth, $breadcrumb, $filter, $sortBy, $sortOrder, $children) {
                    $collection = $collectionManager->getById(
                        $id,
                        $locale,
                        $depth,
                        $breadcrumb,
                        $filter,
                        null !== $sortBy ? [$sortBy => $sortOrder] : [],
                        $children
                    );

                    if (SystemCollectionManagerInterface::COLLECTION_TYPE === $collection->getType()->getKey()) {
                        $this->get('sulu_security.security_checker')->checkPermission(
                            'sulu.media.system_collections',
                            PermissionTypes::VIEW
                        );
                    }

                    return $collection;
                }
            );
        } catch (CollectionNotFoundException $cnf) {
            $view = $this->view($cnf->toArray(), 404);
        } catch (MediaException $e) {
            $view = $this->view($e->toArray(), 400);
        }

        return $this->handleView($view);
    }
1247518
public function fetch($id, Request $request)
    {
        $category = $this->model()->find($id);

        if (is_null($category) || !$category->exists) {
            return $this->notFoundResponse();
        }

        if ($category->private) {
            $this->authorize('view', $category);
        }

        return $this->response($category);
    }
207720
public function showAction($id = null)
    {
        /** @var Request $request */
        $request = $this->get('request_stack')->getCurrentRequest();

        $id = $request->get($this->admin->getIdParameter());

        /** @var PageInterface $object */
        $object = $this->admin->getObject($id);

        if (!$object) {
            throw new NotFoundHttpException(sprintf('unable to find the object with id : %s', $id));
        }

        if (false === $this->admin->isGranted('VIEW', $object)) {
            throw new AccessDeniedException();
        }

        $this->admin->setSubject($object);

        return $this->renderWithExtraParams(
            $this->admin->getTemplate('show'),
            [
                'action' => 'show',
                'object' => $object,
                'elements' => $this->admin->getShow(),
            ]
        );
    }
590932
public function show($id, ShowRequest $request)
    {
        $role = $this->repository->findWithoutFail($id);
        $role->load($request->getWith());

        if (empty($role)) {
            return $this->sendError('Role not found');
        }

        return $this->sendResponse($role, '');
    }
467207
public function deleteAction(Request $request, $id)
    {
        $locale = $this->getLocale($request);

        $delete = function ($id) use ($locale){
            $this->getManager()->delete($id, $this->getUser()->getId());
        };
        $view = $this->responseDelete($id, $delete);

        return $this->handleView($view);
    }
641723
public function updateAction(Request $request, $id)
    {
        $em = $this->getDoctrine()->getManager();

        /** @var BusinessTemplate $pagePattern */
        $pagePattern = $em->getRepository('VictoireBusinessPageBundle:BusinessTemplate')->find($id);

        if (!$pagePattern) {
            throw $this->createNotFoundException('Unable to find BusinessTemplate entity.');
        }

        $editForm = $this->createEditForm($pagePattern);
        $editForm->handleRequest($request);

        if ($editForm->isValid()) {
            $em->flush();

            //redirect to the page of the template
            $completeUrl = $this->generateUrl('victoire_business_template_show', ['id' => $pagePattern->getId()]);
            $message = $this->get('translator')->trans('victoire.business_template.edit.success', [], 'victoire');

            $success = true;
        } else {
            $success = false;
            $completeUrl = null;
            $message = $this->get('translator')->trans('victoire.business_template.edit.error', [], 'victoire');
        }

        return new JsonResponse([
            'success' => $success,
            'url'     => $completeUrl,
            'message' => $message,
        ]);
    }
1024726
public function show($id, ShowRequest $request)
    {
        $user = $request->user();
        $item = $user->notifications()->find($id);
        if (empty($item)) {
            return $this->sendError('Notification not found');
        }
        $item->load($request->getWith());

        return $this->sendResponse($item, '');
    }