GET: Return a thread by ID.

@param  int  $id
@param  Request  $request
@return JsonResponse|Response
970255
public function fetch($id, Request $request)
    {
        $thread = $this->model();
        $thread = $request->input('include_deleted') ? $thread->withTrashed()->find($id) : $thread->find($id);

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

        if ($thread->trashed()) {
            $this->authorize('delete', $thread);
        }

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

        return $this->response($thread);
    }
908874
public function getAction($id, Request $request)
    {
        $includes = explode(',', $request->get('include'));
        $accountManager = $this->getAccountManager();
        $locale = $this->getUser()->getLocale();

        try {
            $view = $this->responseGetById(
                $id,
                function($id) use ($includes, $accountManager, $locale) {
                    return $accountManager->getByIdAndInclude($id, $locale, $includes);
                }
            );

            $context = new Context();
            $context->setGroups(self::$accountSerializationGroups);
            $view->setContext($context);
        } catch (EntityNotFoundException $enfe) {
            $view = $this->view($enfe->toArray(), 404);
        }

        return $this->handleView($view);
    }
183326
public function cgetAction($id, Request $request)
    {
        list($webspaceKey, $languageCode) = $this->getWebspaceAndLanguage($request);
        $result = $this->getResourceLocatorRepository()->getHistory($id, $webspaceKey, $languageCode);

        return $this->handleView($this->view($result));
    }
344253
public function update($id, $request)
    {
        $this->fireEvent('updating', [$id, $request]);

        $updated = $this->find($id)->update($request);

        $this->fireEvent('updated', [$id, $updated]);

        return $updated;
    }
1134427
public function enableThreads($id, Request $request)
    {
        $category = $this->model()->where('enable_threads', 0)->find($id);

        return $this->updateModel($category, ['enable_threads' => 1], 'enableThreads');
    }
785921
public function historyAction(Request $request, $id)
    {
        $document = $this->get('ongr_translations.translation_manager')->get($id);

        if (empty($document)) {
            return new JsonResponse(['error' => true, 'message' => 'translation not found']);
        }

        return new JsonResponse($this->get('ongr_translations.history_manager')->get($document));
    }
210959
public function index(Request $request)
    {
        $this->validate($request, ['category_id' => ['required']]);

        $threads = $this->model()
            ->withRequestScopes($request)
            ->where('category_id', $request->input('category_id'))
            ->get();

        return $this->response($threads);
    }
1273393
public function disableThreads($id, Request $request)
    {
        $category = $this->model()->where('enable_threads', 1)->find($id);

        if (!$category->threads->isEmpty()) {
            return $this->buildFailedValidationResponse($request, trans('forum::validation.category_has_no_threads'));
        }

        return $this->updateModel($category, ['enable_threads' => 0], 'enableThreads');
    }
331197
public function update(Request $request, $id = null)
    {
        // validate data
        $validator = Validator::make($request->all(), [
            'name'         => 'sometimes|required|string|max:255|unique:roles,name,'.$id,
            'display_name' => 'string|max:255',
            'description'  => 'max:1000'
        ]);

        if ($validator->fails()) {
            return response()->json(arrayView('phpsoft.users::errors/validation', [
                'errors' => $validator->errors()
            ]), 400);
        }

        // check role
        $role = Role::find($id);

        if (!$role) {
            return response()->json(null, 404);
        }

        // update role
        $updateRole = $role->update($request->all());

        if (!$updateRole) {
            return response()->json(null, 500); // @codeCoverageIgnore
        }

        return response()->json(arrayView('phpsoft.users::role/read', [
            'role' => $role
        ]), 200);
    }
595223
def get(cls, id):
        '''
        
        '''
        client = cls._new_api_client()
        return client.make_request(cls, 'get', url_params={'id': id})
406342
public function show($id, ShowRequest $request)
    {
        $activityLog = $this->repository->findWithoutFail($id);
        if (empty($activityLog)) {
            return $this->sendError('ActivityLog not found');
        }
        $activityLog->load($request->getWith());

        return $this->sendResponse($activityLog, '');
    }
696407
public function update($id, Request $request)
    {
        $entity = $this->getEntityById($id);

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

        $params = $request->only($this->fillable);

        $result = $this->manager->update($entity, $params);

        if (!$result->ok()) {
            return $this->response(['errors' => $result->getSimpleErrors()], Response::HTTP_BAD_REQUEST);
        }

        return $this->response($this->serialize($result->getResource(), $request), Response::HTTP_OK);
    }
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);
    }
400189
public function getAction(Request $request, $id)
    {
        $locale = $this->getProductLocaleManager()->retrieveLocale($this->getUser(), $request->get('locale'));
        try {
            $attribute = $this->getManager()->findByIdAndLocale($id, $locale);
            $view = $this->view($attribute, 200);
        } catch (AttributeNotFoundException $exc) {
            $exception = new EntityNotFoundException($exc->getEntityName(), $exc->getId());
            $view = $this->view($exception->toArray(), 404);
        }

        return $this->handleView($view);
    }
276726
public function show(Request $request, $id)
    {
        $this->validate($request, [
            'id' => 'uuid'
        ]);

        try{
            $did = $request->user()->dids()->where('id', $id)->with(['tags', 'client'])->firstOrFail();
            $results = fractal()->item($did, new DidTransformer());
            return response()->json($results);
        }catch (\Exception $e){
            return response()->json([ 'error' => 404, 'message' => 'Not found' ], 404);
        }

    }
821299
public function cgetAction($id, Request $request)
    {
        return $this->getMultipleView(
            $this->getContactEntityName(),
            'get_contact_medias',
            $this->get('sulu_contact.contact_manager'),
            $id,
            $request
        );
    }
59764
public function show($id,Request $request)
    {
        if($request->ajax())
        {
            return URL::to('setting/'.$id);
        }

        $setting = Setting::findOrfail($id);
        return view('setting.show',compact('setting'));
    }