Last active
May 10, 2018 15:26
-
-
Save M4R14/8b7b6f091a9fdf278dc1389b9153bff1 to your computer and use it in GitHub Desktop.
Laravel 5 Simple Export CSV
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| namespace App\Http\Controllers; | |
| use Illuminate\Http\Request; | |
| use App\Http\Requests; | |
| use App\Http\Controllers\Controller; | |
| use Excel; | |
| use App\Models\Appointment; | |
| public function export() | |
| { | |
| $datalist = Appointment::get(); | |
| $report15 = function ($excel) use ($datalist) { | |
| $excel->sheet('mySheet', function ($sheet) use ($datalist) { | |
| $sheet->fromArray($datalist); | |
| }); | |
| } | |
| return Excel::create('report15', $report15)->download('csv'); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment