src/Http/Controllers/MessageResourceController.php
public function index(MessageRequest $request)
    {

        if ($this->response->typeIs('json')) {
            $pageLimit = $request->input('pageLimit');
            $data      = $this->repository
                ->setPresenter(\Litepie\Message\Repositories\Presenter\MessageListPresenter::class)
                ->getDataTable($pageLimit);
            return $this->response
                ->data($data)
                ->output();
        }

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

        return $this->response->title(trans('message::message.names'))
            ->view('message::message.index', true)
            ->data(compact('messages'))
            ->output();

    }
public function index(MessageRequest $request)
    {

        if ($this->response->typeIs('json')) {
            $pageLimit = $request->input('pageLimit');
            $data      = $this->repository
                ->setPresenter(\Litepie\Message\Repositories\Presenter\MessageListPresenter::class)
                ->getDataTable($pageLimit);
            return $this->response
                ->data($data)
                ->output();
        }

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

        return $this->response->title(trans('message::message.names'))
            ->view('message::message.index', true)
            ->data(compact('messages'))
            ->output();

    }
public function index ( MessageRequest $ request ) { if ( $ this -> response -> typeIs ( 'json' ) ) { $ pageLimit = $ request -> input ( 'pageLimit' ) ; $ data = $ this -> repository -> setPresenter ( \ Litepie \ Message \ Repositories \ Presenter \ MessageListPresenter :: class ) -> getDataTable ( $ pageLimit ) ; return $ this -> response -> data ( $ data ) -> output ( ) ; } $ messages = $ this -> repository -> paginate ( ) ; return $ this -> response -> title ( trans ( 'message::message.names' ) ) -> view ( 'message::message.index' , true ) -> data ( compact ( 'messages' ) ) -> output ( ) ; }
Display a list of message.

@return Response
Display a list of message .