public function index(NewsRequest $request)
    {
        $view = $this->response->theme->listView();

        if ($this->response->typeIs('json')) {
            $function = camel_case('get-' . $view);
            return $this->repository
                ->setPresenter(\Litecms\News\Repositories\Presenter\NewsPresenter::class)
                ->$function();
        }

        $news = $this->repository->paginate();

        return $this->response->title(trans('news::news.names'))
            ->view('news::news.index', true)
            ->data(compact('news'))
            ->output();
    }
public function index(NewsRequest $request)
    {
        $view = $this->response->theme->listView();

        if ($this->response->typeIs('json')) {
            $function = camel_case('get-' . $view);
            return $this->repository
                ->setPresenter(\Litecms\News\Repositories\Presenter\NewsPresenter::class)
                ->$function();
        }

        $news = $this->repository->paginate();

        return $this->response->title(trans('news::news.names'))
            ->view('news::news.index', true)
            ->data(compact('news'))
            ->output();
    }
public function index ( NewsRequest $ request ) { $ view = $ this -> response -> theme -> listView ( ) ; if ( $ this -> response -> typeIs ( 'json' ) ) { $ function = camel_case ( 'get-' . $ view ) ; return $ this -> repository -> setPresenter ( \ Litecms \ News \ Repositories \ Presenter \ NewsPresenter :: class ) -> $ function ( ) ; } $ news = $ this -> repository -> paginate ( ) ; return $ this -> response -> title ( trans ( 'news::news.names' ) ) -> view ( 'news::news.index' , true ) -> data ( compact ( 'news' ) ) -> output ( ) ; }
Display a list of news.

@return Response
Display a list of news .