bhagat/excel

Supercharged Excel exports and imports in Laravel

v1.0.0 2023-07-04 10:42 UTC

This package is auto-updated.

Last update: 2024-12-16 16:07:27 UTC


README

Generate excel/csv

Command


Run - composer require bhagat/excel:dev-master

Code

web.php / Controller
use App\Exports\ExportUser;
Route::get('/excel', function(){
    return Excel::download(new ExportUser, 'users.xlsx');
});

App\Exports\ExportUser.php

    namespace App\Exports;
	use App\Models\User;
	use Bhagat\Excel\Concerns\FromCollection;

	class ExportUser implements FromCollection {
		public function collection()
		{
			return User::select('name','email')->get();
		}
	}