public function download($query, $filename)
    {
        $this->query      = $query;
        $this->modelClass = get_class($query->getModel());

        $temporary = $this->generateExport();

        if ( ! $temporary) {
            return false;
        }

        return response()->download($temporary, $filename)->deleteFileAfterSend(true);
    }
public function download($query, $filename)
    {
        $this->query      = $query;
        $this->modelClass = get_class($query->getModel());

        $temporary = $this->generateExport();

        if ( ! $temporary) {
            return false;
        }

        return response()->download($temporary, $filename)->deleteFileAfterSend(true);
    }
public function download ( $ query , $ filename ) { $ this -> query = $ query ; $ this -> modelClass = get_class ( $ query -> getModel ( ) ) ; $ temporary = $ this -> generateExport ( ) ; if ( ! $ temporary ) { return false ; } return response ( ) -> download ( $ temporary , $ filename ) -> deleteFileAfterSend ( true ) ; }
Exports data returned by listing query and returns a download response for it.

@param EloquentBuilder|QueryBuilder $query
@param string                       $filename name the download should be given
@return mixed|false
Exports data returned by listing query and returns a download response for it .