public function export($strategy)
    {
        // Check if the strategy is available and allowed to be used
        if ( ! $this->isExportStrategyAvailable($strategy)) {
            abort(403, "Not possible or allowed to perform export '{$strategy}'");
        }

        // Prepare the strategy instance
        $exporter = $this->getExportStrategyInstance($strategy);
        $filename = $this->getExportDownloadFilename($strategy, $exporter->extension());

        $this->checkListParents()
             ->checkActiveSort(false)
             ->checkScope(false)
             ->checkFilters()
             ->checkActivePage(false)
             ->applySort()
             ->applyScope($this->modelRepository);

        $query = $this->getModelRepository()->query();

        $this->applyFilter($query)
             ->applyListParentToQuery($query);

        $download = $exporter->download($query, $filename);

        if (false === $download) {
            // @codeCoverageIgnoreStart
            abort(500, "Failed to export model listing for strategy '{$strategy}'");
            // @codeCoverageIgnoreEnd
        }

        event( new Events\ModelListExportedInCms($this->modelInformation->modelClass(), $strategy) );

        return $download;
    }
public function export($strategy)
    {
        // Check if the strategy is available and allowed to be used
        if ( ! $this->isExportStrategyAvailable($strategy)) {
            abort(403, "Not possible or allowed to perform export '{$strategy}'");
        }

        // Prepare the strategy instance
        $exporter = $this->getExportStrategyInstance($strategy);
        $filename = $this->getExportDownloadFilename($strategy, $exporter->extension());

        $this->checkListParents()
             ->checkActiveSort(false)
             ->checkScope(false)
             ->checkFilters()
             ->checkActivePage(false)
             ->applySort()
             ->applyScope($this->modelRepository);

        $query = $this->getModelRepository()->query();

        $this->applyFilter($query)
             ->applyListParentToQuery($query);

        $download = $exporter->download($query, $filename);

        if (false === $download) {
            // @codeCoverageIgnoreStart
            abort(500, "Failed to export model listing for strategy '{$strategy}'");
            // @codeCoverageIgnoreEnd
        }

        event( new Events\ModelListExportedInCms($this->modelInformation->modelClass(), $strategy) );

        return $download;
    }
public function export ( $ strategy ) { // Check if the strategy is available and allowed to be used if ( ! $ this -> isExportStrategyAvailable ( $ strategy ) ) { abort ( 403 , "Not possible or allowed to perform export '{$strategy}'" ) ; } // Prepare the strategy instance $ exporter = $ this -> getExportStrategyInstance ( $ strategy ) ; $ filename = $ this -> getExportDownloadFilename ( $ strategy , $ exporter -> extension ( ) ) ; $ this -> checkListParents ( ) -> checkActiveSort ( false ) -> checkScope ( false ) -> checkFilters ( ) -> checkActivePage ( false ) -> applySort ( ) -> applyScope ( $ this -> modelRepository ) ; $ query = $ this -> getModelRepository ( ) -> query ( ) ; $ this -> applyFilter ( $ query ) -> applyListParentToQuery ( $ query ) ; $ download = $ exporter -> download ( $ query , $ filename ) ; if ( false === $ download ) { // @codeCoverageIgnoreStart abort ( 500 , "Failed to export model listing for strategy '{$strategy}'" ) ; // @codeCoverageIgnoreEnd } event ( new Events \ ModelListExportedInCms ( $ this -> modelInformation -> modelClass ( ) , $ strategy ) ) ; return $ download ; }
Exports the current listing with a given strategy.

@param string $strategy
@return false|mixed
Exports the current listing with a given strategy .