, который работал
, я отказался от использования ajax и просто попытался с помощью маршрутов
Route::get('relatorios/exportar/{cod}', array('as' => 'relatorios.exportar', 'uses' => 'ReportsController@exportar'));
мой контроллер
public function exportar($cod)
{
set_time_limit(0);
$datainicio = DB::table('tb_periodo')->where('cod', $cod)->pluck('periodo_inicio');
$datafinal = DB::table('tb_periodo')->where('cod', $cod)->pluck('periodo_fim');
$mes = DB::table('tb_periodo')->where('cod', $cod)->pluck('mes_referencia');
$horarioQuery = $this->horario->with(array('funcionario', 'item_contabil'))
->whereBetween('data', array($datainicio, $datafinal))
->whereNull('deleted_at')
->orderBy('cod_funcionario')
->orderBy('data', 'ASC')
->get();
$horarios = reset($horarioQuery);
$nome = 'Marcações'.$mes.'-'.Carbon::now()->year;
$this->horario->allToExcel($nome, $horarios);
}
view:
{{ link_to_route('relatorios.exportar', 'Exportar para excel', array($cod), array('class' => 'btn btn-success')) }}
, который решен для меня, потому что не загружайте другую страницу и загружайте правильный файл. thx за помощь !!