Display faq.

@param Request $request
@param Model   $faq

@return Response
6786
public function show(FaqRequest $request, Faq $faq)
    {

        if ($faq->exists) {
            $view = 'faq::faq.show';
        } else {
            $view = 'faq::faq.new';
        }

        return $this->response->title(trans('app.view') . ' ' . trans('faq::faq.name'))
            ->data(compact('faq'))
            ->view($view, true)
            ->output();
    }
392749
public function execute(Request $request)
    {
        $command = $request->input('command');

        if ($command === '') {
            $command = 'list';
        }

        $output= new BufferedOutput;

        Artisan::handle(new StringInput($command.self::NON_INTERACTIVE), $output);
        $results = $output->fetch();

        return view('gae-support-l5::artisan', compact(['command', 'results']));
    }
961387
public function index(Request $request)
    {
        $permissions = Permission::browse([
            'order'     => [ Input::get('sort', 'id') => Input::get('direction', 'desc') ],
            'limit'     => ($limit = (int)Input::get('limit', 25)),
            'offset'    => (Input::get('page', 1) - 1) * $limit,
            'filters'   => $request->all()
        ]);

        return response()->json(arrayView('phpsoft.users::permission/browse', [
            'permissions' => $permissions,
        ]), 200);
    }
1339457
public function showSearchResultsAction(Request $request)
    {
        $response = new Response();
        $searchText = '';
        $searchCount = 0;

        // Creating a form using Symfony's form component
        $simpleSearch = new SimpleSearch();
        $form = $this->createForm($this->get('ezdemo.form.type.simple_search'), $simpleSearch);
        $form->handleRequest($request);

        $pager = null;

        if ($form->isValid()) {
            /** @var SearchHelper $searchHelper */
            $searchHelper = $this->get('ezdemo.search_helper');

            if (!empty($simpleSearch->searchText)) {
                $searchText = $simpleSearch->searchText;

                $pager = $searchHelper->searchForPaginatedContent(
                    $searchText,
                    $request->get('page', 1),
                    $this->getConfigResolver()->getParameter('languages')
                );

                $searchCount = $pager->getNbResults();
            }
        }

        return $this->render(
            'eZDemoBundle:search:search.html.twig',
            array(
                'searchText' => $searchText,
                'searchCount' => $searchCount,
                'pagerSearch' => $pager,
                'form' => $form->createView(),
            ),
            $response
        );
    }
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);
    }
689490
public function listAction(Request $request)
    {
        $current_page = $request->get('page', 1);
        $current_page = $current_page > 1 ? $current_page : 1;
        $rep = $this->getRepository();

        // filter list notice
        $filter = $this->createForm('notices_filter')->handleRequest($request);
        if ($filter->isValid()) {
            $query = $rep->getFilteredQuery($filter->getData()['status'], $filter->getData()['type']);
        } else {
            $query = $rep->createQueryBuilder('n');
        }
        $query
            ->orderBy('n.date_created', 'DESC')
            ->setFirstResult(($current_page - 1) * self::NOTICE_PER_PAGE)
            ->setMaxResults(self::NOTICE_PER_PAGE);
        $list = $query->getQuery()->getResult();

        // get count all items
        $count = $query
            ->select('COUNT(n)')
            ->getQuery()
            ->getSingleScalarResult();

        // pagination
        $that = $this;
        $request_query = $request->query->all();
        unset($request_query['page']);
        $pagination = $this->get('anime_db.pagination')
            ->create(ceil($count / self::NOTICE_PER_PAGE), $current_page)
            ->setPageLink(function ($page) use ($that, $request_query) {
                return $that->generateUrl('notice_list', array_merge($request_query, ['page' => $page]));
            })
            ->setFirstPageLink($this->generateUrl('notice_list', $request_query))
            ->getView();

        return $this->render('AnimeDbCatalogBundle:Notice:list.html.twig', [
            'list' => $list,
            'pagination' => $pagination,
            'change_form' => $this->createForm(new ChangeNotice())->createView(),
            'filter' => $filter->createView(),
            'action_remove' => ChangeNotice::ACTION_REMOVE,
        ]);
    }
131738
public function searchAction(Request $request)
    {
        $response = $this->getCacheTimeKeeper()
            ->getResponse(['AnimeDbCatalogBundle:Item', 'AnimeDbCatalogBundle:Storage']);
        // response was not modified for this request
        if ($response->isNotModified($request)) {
            return $response;
        }

        /* @var $form Form */
        $form = $this->createForm('animedb_catalog_search', new SearchEntity())->handleRequest($request);
        $pagination = null;
        $result = ['list' => [], 'total' => 0];

        if ($form->isValid()) {
            /* @var $controls ListControls */
            $controls = $this->get('anime_db.item.list_controls');

            // current page for paging
            $current_page = $request->get('page', 1);
            $current_page = $current_page > 1 ? $current_page : 1;

            // get items limit
            $limit = $controls->getLimit($request->query->all());

            // do search
            $result = $this->get('anime_db.item.search')->search(
                $form->getData(),
                $limit,
                ($current_page - 1) * $limit,
                $controls->getSortColumn($request->query->all()),
                $controls->getSortDirection($request->query->all())
            );

            if ($limit) {
                // build pagination
                $that = $this;
                $query = $request->query->all();
                unset($query['page']);
                $pagination = $this->get('anime_db.pagination')
                    ->create(ceil($result['total'] / $limit), $current_page)
                    ->setPageLink(function ($page) use ($that, $query) {
                        return $that->generateUrl('home_search', array_merge($query, ['page' => $page]));
                    })
                    ->setFirstPageLink($this->generateUrl('home_search', $query))
                    ->getView();
            }
        }

        return $this->render('AnimeDbCatalogBundle:Home:search.html.twig', [
            'form' => $form->createView(),
            'items' => $result['list'],
            'total' => $result['total'],
            'pagination' => $pagination,
            'searched' => (bool) $request->query->count(),
        ], $response);
    }
994053
public function displayRegisterForm(Request $request)
    {
        if (!$this->getRegistrationManager()->isRegistrationEnabled()) {
            $this->app->abort(404, 'Registration is disabled');
        }

        if (0 < count($this->getAuthenticationProviders())) {
            return $this->render('login/register.html.twig', $this->getDefaultTemplateVariables($request));
        } else {
            return $this->app->redirectPath('login_register_classic');
        }
    }
1237378
public function show(GalleryRequest $request, Gallery $gallery)
    {

        if ($gallery->exists) {
            $view = 'gallery::gallery.show';
        } else {
            $view = 'gallery::gallery.new';
        }

        return $this->response->title(trans('app.view') . ' ' . trans('gallery::gallery.name'))
            ->data(compact('gallery'))
            ->view($view, true)
            ->output();
    }
948968
public function index(Request $request)
    {
        // handle permission
//        list($request, $filters) = $this->handlePermission(__FUNCTION__, $request);

        // create response model
        $response = new ResponseModel();

        $pageSize = $this->DEFAULT_RESULT_PER_PAGE;

        $pageNumber = 1;

        //set default pagination

        //set page size
        if (!isset($request->toArray()['page']['size'])) {
            $pageSize = $this->DEFAULT_RESULT_PER_PAGE;
        } elseif (($request->get('page')['size']) == 0) {
            $pageSize = $this->DEFAULT_RESULT_PER_PAGE;
        } else {
            $pageSize = $request->get('page')['size'];
        }

        //set page number
        if (!isset($request->get('page')['number'])) {
            $pageNumber = $this->DEFAULT_PAGE_NUMBER;
        } elseif (($request->get('page')['number']) == 0) {
            $pageNumber = $this->DEFAULT_PAGE_NUMBER;
        } else {
            $pageNumber = $request->get('page')['number'];
        }
        $request['page'] = $pageNumber;


        //set default ordering
        if (isset($request->toArray()['order_by'])) {
            if (is_null($request['order_by'])) {
                $request['order_by'] = "{\"field\":\"id\",\"operator\":\"Desc\"}";
            }
        }

        $validationErrors = $this->checkRequestValidation($request, $this->indexValidateArray);
        if ($validationErrors != null) {
            if (env('APP_DEBUG', false)) {
                $response->setData(collect($validationErrors->toArray()));
            }
            $response->setMessage($this->getTrans(__FUNCTION__, 'validation_failed'));
            $response->setStatus(false);
            $response->setError(99);
            return SmartResponse::response($response);
        }

        try {
            $data = $request->get('query') != null ?
                $this->model
                    ->whereKey(collect($this->model
                        ->search(($request->get('query')))
                        ->raw())->get('ids')) :
                $this->model;

            if (array_key_exists('file', $request->toArray())) {
                //TODO add relation on top if here and create a tree flatter array in array helper
                //return (new ExcelHelper())->setOptions([
                //    'store_format' => $request->get('file') == null ? 'xls' : $request->get('file'),
                //    'download_format' => $request->get('file') == null ? 'xls' : $request->get('file'),
                //])->table($data->get()->toArray())->createExcelFile()->download();
            }

            // load relations
            if (count($this->indexLoad) > 0) {
                $data = $data->with($this->indexLoad);
            }

            // filters by
            if (!is_null($request->get('filters'))) {
                $data = (new QueryHelper())->deepFilter($data, (new RequestHelper())->getCollectFromJson($request['filters']));
            }

            // order by
            if (!is_null($request->get('order_by'))) {
                $data = (new QueryHelper())->orderBy($data, (new RequestHelper())->getCollectFromJson($request['order_by']));
            }

            // return response
            $response->setData(collect($data->paginate($pageSize)));
            $response->setMessage($this->getTrans('index', 'successful'));
            return SmartResponse::response($response);

        } catch (QueryException $exception) {

            // return response
            $response->setData(collect($exception->getMessage()));
            $response->setError($exception->getCode());
            $response->setMessage($this->getTrans('index', 'failed'));
            $response->setStatus(false);
            return SmartResponse::response($response);
        }
    }
411363
public function searchInAllAction(Request $request)
    {
        /* @var $chain ChainSearch */
        $chain = $this->get('anime_db.plugin.search_fill');
        $response = $this->getResponseFromChain($chain);

        // response was not modified for this request
        if ($response->isNotModified($request)) {
            return $response;
        }

        /* @var $form Form */
        $form = $this->createForm(new SearchFrom());
        $form->handleRequest($request);

        return $this->render('AnimeDbCatalogBundle:Fill:search_in_all.html.twig', [
            'plugins' => $chain->getPlugins(),
            'form' => $form->createView(),
        ], $response);
    }
24214
public function show($date, Request $request)
    {
        $level   = 'all';
        $log     = $this->getLogOrFail($date);
        $query   = $request->get('query');
        $levels  = $this->logViewer->levelsNames();
        $entries = $log->entries($level)->paginate($this->perPage);

        return $this->view('show', compact('level', 'log', 'query', 'levels', 'entries'));
    }
342103
public function indexAction(Request $request)
    {
        $manager = $this->get('compo_faq.manager.faq');

        $page = $request->get('page', 1);

        $pager = $manager->getPager([], $page);
        $totalPages = $pager->getPageCount();

        $seoPage = $this->get('sonata.seo.page');
        $seoPage->setContext('faq_list');
        $seoPage->addVar('page', $page);
        $seoPage->addVar('total_pages', $pager->getPageCount());

        if (1 !== $page) {
            $seoPage->setLinkCanonical($manager->getFaqIndexPermalink(['page' => $page], 0));
            $metas = $seoPage->getMetas();
            $metas['name']['robots'] = 'noindex, follow';
            $seoPage->setMetas($metas);
        } else {
            $seoPage->setLinkCanonical($manager->getFaqIndexPermalink([], 0));
        }

        if ($totalPages > 1 && $page < $totalPages) {
            $seoPage->setLinkNext($manager->getFaqIndexPermalink(['page' => $page + 1], 0));
        }

        if ($totalPages > 1 && $page > 1) {
            $seoPage->setLinkPrev($manager->getFaqIndexPermalink(['page' => $page - 1], 0));
        }

        $seoPage->build();

        return $this->render(
            'CompoFaqBundle:Faq:index.html.twig',
            [
                'pager' => $pager,
            ]
        );
    }
96245
public function index(Request $request)
    {
        $categories = $this->model()->withRequestScopes($request);

        $categories = $categories->get()->filter(function ($category) {
            if ($category->private) {
                return Gate::allows('view', $category);
            }

            return true;
        });

        return $this->response($categories);
    }
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);
    }
1242464
public function indexAction(Request $request)
    {
        $layouts = $this->get('opifer.content.layout_manager')->getRepository()
            ->findAll();

        $data = $this->get('jms_serializer')->serialize($layouts, 'json');

        return new Response($data, 200, ['Content-Type' => 'application/json']);
    }
394655
public function show(Request $request)
    {
        $post = $this->api('post.fetch', $request->route('post'))->parameters(['with' => ['thread', 'thread.category', 'parent']])->get();

        event(new UserViewingPost($post));

        $thread = $post->thread;
        $category = $thread->category;

        return view('forum::post.show', compact('category', 'thread', 'post'));
    }