Skip to content

Instantly share code, notes, and snippets.

@prio101
Last active January 22, 2016 03:54
Show Gist options
  • Save prio101/01a5f26da2a76be24db1 to your computer and use it in GitHub Desktop.
Save prio101/01a5f26da2a76be24db1 to your computer and use it in GitHub Desktop.
Please check this
<?php
use Maatwebsite\Excel\Excel;
use Carbon\Carbon;
use App\Model\BokkingsModel;
class SomeController extends Controller{
/**
* Export to Excel data sheet
*
* @return \Maatwebsite\Excel\Excel
* */
public function excel(Excel $excel){
$carbon = Carbon::now();
$doc = $excel->create('Bookings-Excel-Sheet'.$carbon , function($excel){
$excel->sheet('Bookings-excel-sheet' , function($sheet){
$bookings = BookingsModel::all();
$sheet->loadView('admin/bookings/partials/bookings-part',['bookings' => $bookings ]);
});
});
return $doc;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment