Call mathod to get first label for $attr autocomplete input
@param  Request $request - with
'crudeName' - crude class name
'attr'  - attribute name
'value' - model[attr]
@return JSON with string
515132
public function label(AutocompleteRequest $request)
    {
        $crude = CrudeInstance::get($request->input('crudeName'));
        $attr = $this->underscoreToCamelCase($request->input('attr'));
        $value = $request->input('value');
        $methodName = 'label' . $attr;

        $result = '';
        if (method_exists($crude, $methodName))
            $result = call_user_func([$crude, $methodName], $value);

        return response()->json($result, 200);
    }
688871
private function getLanguage(Request $request)
    {
        $locale = $this->getRequestParameter($request, 'locale', false, null);

        if ($locale) {
            return $locale;
        }

        return $this->getRequestParameter($request, 'language', true);
    }
1107092
public function getAttributeValue($attr, &$request = null) {
        $url = "entities/{$this->_id}/attrs/$attr/value";

        if ($this->_type) {
            $url .= "?type={$this->_type}";
        }

        return $this->_orion->get($url, $request, "text/plain","text/plain");
    }
787732
protected function getFormat(Request $request)
    {
        $format = $request->getQueryParam('format');
        if (!isset($format)) {
            $format = $this->defaultFormat;
        }

        return $format;
    }
44883
public function listChartAction(Request $request)
    {
        $query = $this->addOrganizationFilter($request->query->all());
        $chartData = $this->logManager->getChartData($query);

        return new JsonResponse($chartData);
    }
740371
public function showAction(Request $request)
    {
        $gridSource = $this->get('dtc_grid.manager.source')->get($request->get('id'));
        $id = $request->get('identifier');
        $result = $gridSource->find($id);

        $responseResult = [];
        if (!$result) {
            return new Response('Not Found', 404);
        }
        if (is_array($result)) {
            foreach ($result as $key => $value) {
                $responseResult[$this->fromCamelCase($key)] = $value;
            }
        } elseif (method_exists($gridSource, 'getClassMetadata')) {
            $classMetadata = $gridSource->getClassMetadata();
            $fieldNames = $classMetadata->getFieldNames();
            foreach ($fieldNames as $fieldName) {
                $method = 'get'.ucfirst($fieldName);
                if (method_exists($result, $method)) {
                    $responseResult[$this->fromCamelCase($fieldName)] = $result->$method();
                }
            }
        }

        return new JsonResponse($responseResult);
    }
1276654
protected function getRequestToken($request)
    {
        $name = $this->getName();
        $header = 'X-' . ucwords(strtolower($name));
        if ($token = $request->getHeader($header)) {
            return $token;
        }

        // Get from request var
        return $request->requestVar($name);
    }
924141
protected function fetchToken(Request $request): string
    {
        if ($request->hasHeader(self::HEADER)) {
            return (string)$request->getHeaderLine(self::HEADER);
        }

        $data = $request->getParsedBody();
        if (is_array($data) && isset($data[self::PARAMETER])) {
            if (is_string($data[self::PARAMETER])) {
                return (string)$data[self::PARAMETER];
            }
        }

        return '';
    }
1010281
public function getSearchCharacterAssetsData(Request $request)
    {

        $assets = $this->doSearchCharacterAssets();

        return DataTables::of($assets)
            ->editColumn('characterName', function ($row) {

                $character = CharacterInfo::find($row->character_id) ?: $row->character_id;

                return view('web::partials.character', compact('character'));
            })
            ->editColumn('typeName', function ($row) {

                return view('web::search.partials.typename', compact('row'));
            })
            ->rawColumns(['characterName', 'typeName'])
            ->make(true);

    }
958795
public function orderInlineEditAction(Request $request)
    {
        $value = $request->get('value');
        $manager = $this->getDoctrine()->getManager();
        $repo = $manager->getRepository('LibrinfoEcommerceBundle:Order');

        $order = $repo->find($request->get('id'));

        $propertyAccessor = new PropertyAccessor();
        $propertyAccessor->setValue($order, $request->get('field'), $value);

        $manager->persist($order);
        $manager->flush();

        return new JsonResponse($value);
    }
202435
private function getDefaultName(Request $request)
    {
        if (!preg_match('/Bundle\\\\Controller\\\\([\w\\\\]+)Controller:/', $request->attributes->get('_controller'), $match)) {
            throw new \RuntimeException('Unable to determine controller name');
        }

        return strtolower(str_replace('\\', '_', $match[1]));
    }
350665
protected function getTermData(Request $request)
    {
        $data = [];

        foreach ($this->repository as $field) {
            $data[$field->getName()] = $request->get($field->getName());
        }

        return $data;
    }
1273188
public function schema($request)
    {
        $formName = $request->param('FormName');
        $itemID = $request->param('ItemID');

        if (!$formName) {
            $this->jsonError(400, 'Missing request params');
            return null;
        }

        $formMethod = "get{$formName}";
        if (!$this->hasMethod($formMethod)) {
            $this->jsonError(404, 'Form not found');
            return null;
        }

        if (!$this->hasAction($formName)) {
            $this->jsonError(401, 'Form not accessible');
            return null;
        }

        if ($itemID) {
            $form = $this->{$formMethod}($itemID);
        } else {
            $form = $this->{$formMethod}();
        }
        $schemaID = $request->getURL();
        return $this->getSchemaResponse($schemaID, $form);
    }
439654
protected function parseRouteRequest (Request $request)
		{
			$routeString = preg_replace('#(^' . preg_quote(rtrim($this->getBaseUri($request), '/'), '#') . ')#', '', $request->getUri(false));
			$routeString = strtok($routeString, '#?');
			$routeString = trim($routeString, '/');

			$parsed = parent::parseRouteRequest($request);

			if (
				! in_array($parsed['method'], array('index', 'get', 'insert', 'update', 'delete'))
				&& $this->getController($request)->respondsTo($parsed['method'])
			) {
				return $parsed;

			} else if ($request->getMethod() == 'GET' && preg_match('#^[^/][^/]*$#', $routeString)) {
				return array(
					'method' => 'get',
					'arguments' => array_filter(explode('/', $routeString)),
				);

			} else if ($request->getMethod() == 'GET' && $routeString == '') {
				return array(
					'method'    => 'index',
					'arguments' => array()
				);

			} else if ($request->getMethod() == 'DELETE' && preg_match('#^[^/][^/]*$#', $routeString)) {
				return array(
					'method'    => 'delete',
					'arguments' => array_filter(explode('/', $routeString)),
				);

			} else if ($request->getMethod() == 'POST' && preg_match('#^[^/][^/]*$#', $routeString)) {
				return array(
					'method'    => 'update',
					'arguments' => array_filter(explode('/', $routeString)),
				);

			} else if ($request->getMethod() == 'POST' && $routeString == '') {
				return array(
					'method'    => 'insert',
					'arguments' => array()
				);

			} else {
				if (in_array($parsed['method'], array('index', 'get', 'insert', 'update', 'delete'))) {
					$parsed['method'] = ' non-existent method ';
				}

				return $parsed;
			}
		}
690867
public function getStandingsAjaxElementName(Request $request)
    {

        $response = [
            'results' => [],
        ];

        if (strlen($request->input('search')) > 0) {

            try {

                // Resolve the Esi client library from the IoC
                $eseye = app('esi-client')->get();
                $eseye->setVersion('v2');
                $eseye->setQueryString([
                    'categories' => $request->input('type'),
                    'search'     => $request->input('search'),
                ]);

                $entityIds = $eseye->invoke('get', '/search/');

                if (! property_exists($entityIds, $request->input('type')))
                    return response()->json([]);

                if (count($entityIds->{$request->input('type')}) < 1)
                    return response()->json();

                collect($entityIds->{$request->input('type')})->unique()
                    ->filter(function ($id) use (&$response) {

                        // Next, filter the ids we have in the cache, setting
                        // the appropriate response values as we go along.
                        if ($cached_entry = cache('name_id:' . $id)) {

                            $response['results'][] = [
                                'id'   => $id,
                                'text' => $cached_entry,
                            ];

                            // Remove this as a valid id, we already have the value we want.
                            return false;
                        }

                        // We don't have this id in the cache. Return it
                        // so that we can update it later.
                        return true;

                    })->chunk(1000)->each(function ($chunk) use (&$response, $eseye) {

                        $eseye->setVersion('v2');
                        $eseye->setBody($chunk->flatten()->toArray());
                        $names = $eseye->invoke('post', '/universe/names/');

                        collect($names)->each(function ($name) use (&$response) {

                            // Cache the name resolution for this id for a long time.
                            cache(['name_id:' . $name->id => $name->name], carbon()->addCentury());

                            $response['results'][] = [
                                'id'   => $name->id,
                                'text' => $name->name,
                            ];
                        });

                    });

            } catch (Exception $e) {
            }
        }

        return response()->json($response);
    }
1050355
protected function getScript($request)
    {
        $kernel = var_export(serialize($this->kernel), true);
        $request = var_export(serialize($request), true);

        $errorReporting = error_reporting();

        $requires = '';
        foreach (get_declared_classes() as $class) {
            if (0 === strpos($class, 'ComposerAutoloaderInit')) {
                $r = new \ReflectionClass($class);
                $file = \dirname(\dirname($r->getFileName())).'/autoload.php';
                if (file_exists($file)) {
                    $requires .= 'require_once '.var_export($file, true).";\n";
                }
            }
        }

        if (!$requires) {
            throw new \RuntimeException('Composer autoloader not found.');
        }

        $code = <<<EOF
<?php

error_reporting($errorReporting);

$requires

\$kernel = unserialize($kernel);
\$request = unserialize($request);
EOF;

        return $code.$this->getHandleScript();
    }
1134504
public function chooserIndexAction(Request $request)
    {
        $type = $request->get('type');
        $cKEditorFuncNum = $request->get('CKEditorFuncNum');

        $em = $this->getDoctrine()->getManager();

        /* @var Folder $firstFolder */
        $firstFolder = $em->getRepository('VictoireMediaBundle:Folder')->getFirstTopFolder();

        return $this->redirect($this->generateUrl('VictoireMediaBundle_chooser_show_folder', ['folderId' => $firstFolder->getId(), 'type' => $type, 'CKEditorFuncNum' => $cKEditorFuncNum]));
    }