Get all of the failed jobs.

@param  \Illuminate\Http\Request  $request
@return array
767317
public function index(Request $request)
    {
        $jobs = ! $request->query('tag')
                ? $this->paginate($request)
                : $this->paginateByTag($request, $request->query('tag'));

        $total = $request->query('tag')
                ? $this->tags->count('failed:'.$request->query('tag'))
                : $this->jobs->countFailed();

        return [
            'jobs' => $jobs,
            'total' => $total,
        ];
    }
507952
protected function buildFailedValidationResponse(Request $request, $errors)
    {
        $content = [
            'error'             => "The submitted data did not pass validation.",
            'validation_errors' => (array) $errors
        ];

        return ($request->ajax() && !$request->pjax() || $request->wantsJson())
            ? new JsonResponse($content, 422)
            : new Response($content, 422);
    }
1060023
private function getRequestOptions(Request $request)
    {
        $options = [
            'http_errors' => false,
            'synchronous' => true
        ];

        if ($request->getQuery()) {
            $options['query'] = array_merge($this->getDefaultQuery(), $request->getQuery());
        } else {
            $options['query'] = $this->getDefaultQuery();
        }
        if ($request->getParams())
            $options['json'] = $request->getParams();

        return $options;
    }
183171
public function toResponse($request)
    {
        $headers = array();
        if ($this->retryAfter) {
            $headers = array('Retry-After' => $this->retryAfter);
        }

        // Figure out what view to show them
        // @TODO: fallback to the default 503 page (laravel/framework/src/Illuminate/Foundation/Exceptions/views/503.blade.php)
        $view = view()->first([$this->view, config("maintenancemode.view"), "errors/503", "maintenancemode::app-down"], []);

        return response($view, 503)->withHeaders($headers);
    }
1006095
public function run($request) {
		$failedFiles = 0;
		$Videos = VideoFile::get()->filter(array('ProcessingStatus' => 'error'))->sort('ID');

		foreach($Videos as $vid){
			
			$failedFiles++;
			
			$vid->ProcessingStatus = 'new';
			$vid->write();
			
			$vid->onAfterLoad();
			
			sleep(5);
		}

		echo "$failedFiles failed VideoFile objects have reinitiated the processing.";
	}
1295838
public function listRoles(Request $request)
    {
        $roles = array();
        if ($request->query->has('identifier')) {
            try {
                $role = $this->roleService->loadRoleByIdentifier($request->query->get('identifier'));
                $roles[] = $role;
            } catch (APINotFoundException $e) {
                // Do nothing
            }
        } else {
            $offset = $request->query->has('offset') ? (int)$request->query->get('offset') : 0;
            $limit = $request->query->has('limit') ? (int)$request->query->get('limit') : -1;

            $roles = array_slice(
                $this->roleService->loadRoles(),
                $offset >= 0 ? $offset : 0,
                $limit >= 0 ? $limit : null
            );
        }

        return new Values\RoleList($roles, $request->getPathInfo());
    }
1015302
public function get_all_dirs(Request $request)
    {
        $folderLocation = $request->folder_location;

        if (is_array($folderLocation)) {
            $folderLocation = rtrim(implode('/', $folderLocation), '/');
        }

        $location = "{$this->directory}/{$folderLocation}";

        return response()->json(
            str_replace($location, '', Storage::disk($this->filesystem)->directories($location))
        );
    }
1147406
public function sort(Request $request)
    {
        $sortableEntities = app('config')->get('sortable.entities', []);
        $validator = $this->getValidator($sortableEntities, $request);

        if (!$validator->passes()) {
            return [
                'success' => false,
                'errors' => $validator->errors(),
                'failed' => $validator->failed(),
            ];
        }

        /** @var Model|bool $entityClass */
        list($entityClass, $relation) = $this->getEntityInfo($sortableEntities, (string) $request->input('entityName'));
        $method = ($request->input('type') === 'moveAfter') ? 'moveAfter' : 'moveBefore';

        if (!$relation) {
            /** @var SortableTrait $entity */
            $entity = $entityClass::find($request->input('id'));
            $postionEntity = $entityClass::find($request->input('positionEntityId'));
            $entity->$method($postionEntity);
        } else {
            $parentEntity = $entityClass::find($request->input('parentId'));
            $entity = $parentEntity->$relation()->find($request->input('id'));
            $postionEntity = $parentEntity->$relation()->find($request->input('positionEntityId'));
            $parentEntity->$relation()->$method($entity, $postionEntity);
        }

        return ['success' => true];
    }
774853
public function searchAction(Request $request)
    {
        // get all modules
        $moduleManager =  $this->get('terrific.composer.module.manager');
        $modules = $moduleManager->getModules();

        // get all pages
        $pageManager =  $this->get('terrific.composer.page.manager');
        $pages = $pageManager->getPages();

        // merge the results
        $results = array_merge($modules, $pages);

        return array('results' => $results);
    }
1243598
private function getSerializerOptions(Request $request): array
    {
        $validation = $this->getValidatorOptions($request);
        $context = [];

        if ($validation['groups']) {
            $context['groups'] = $validation['groups'];
        }

        if (isset($validation['populate']) && $request->attributes->has($validation['populate'])) {
            $context['object_to_populate'] = clone $request->attributes->get($validation['populate']);
        }

        switch ($request->getMethod()) {
            case Request::METHOD_PUT:
            case Request::METHOD_POST:
                return [$request->getContent(), $request->getContentType(), $context];
            case Request::METHOD_GET:
                if (!isset($context[ObjectNormalizer::DISABLE_TYPE_ENFORCEMENT])) {
                    $context[ObjectNormalizer::DISABLE_TYPE_ENFORCEMENT] = true;
                }

                return [$request->query->all(), null, $context];
        }

        return [[], null, $context];
    }
576574
public function getFailures(): array
    {
        $errors = [];

        foreach ($this->getActionExceptions() as $actionException) {
            $errors[] = $actionException->getMessage();
        }

        return $errors;
    }
966659
private function showAttempts(Request $request)
    {
        if ($this->config['show_attempts_left'] && $this->config['throttle']) {
            return TransFormer::transform($this->retriesLeft($request), $this->config['attempts_message']);
        }

        return false;
    }
1108375
public function index(Request $request)
    {
        $categories = $this->category->all();

        return Response::json(['errors' => false, 'data' => $categories]);
    }
458506
public function index(Request $request)
    {
        $jobs = $this->jobs->getRecent($request->query('starting_at', -1))->map(function ($job) {
            $job->payload = json_decode($job->payload);

            return $job;
        })->values();

        return [
            'jobs' => $jobs,
            'total' => $this->jobs->countRecent(),
        ];
    }
627513
protected function getMiddlewareHandlers(\Owl\Http\Request $request)
    {
        if (!$this->middleware_handlers) {
            return [];
        }

        $request_path = $this->getRequestPath($request);

        $result = [];
        foreach ($this->middleware_handlers as $path => $handlers) {
            if (strpos($request_path, $path) === 0) {
                $result = array_merge($result, $handlers);
            }
        }

        return $result;
    }
14609
public function execute($request)
    {
        $result = $request->authHeaders()->send();

        if ($result->status === self::API_STATUS_FAIL) {
            throw new Exception('Error: '.$result->error);
        }

        return $result;
    }
574797
private function getRoles($request)
    {
        $routeActions = $this->getActions($request);

        $roles = array_get($routeActions, 'is', []);

        return is_array($roles) ? $roles : (array) $roles;
    }