Package Data | |
---|---|
Maintainer Username: | msamec |
Maintainer Contact: | filip.horvat@am2studio.hr (Filip Horvat) |
Package Create Date: | 2016-02-15 |
Package Last Update: | 2020-12-23 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-19 03:12:16 |
Package Statistics | |
---|---|
Total Downloads: | 3,690 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 3 |
Total Watchers: | 12 |
Total Forks: | 1 |
Total Open Issues: | 0 |
Package contains trait for exporting documents
Via Composer
$ composer require am2studio/laravel-exporter
Trait in controller :
/**
* Class UserController
* @package App\Http\Controllers\Backend\Admin
*/
class UserController extends Controller
{
use \AM2Studio\Laravel\Exporter\Exporter;
Using trait function in controller
/**
* @return mixed
*/
public function csv()
{
$users = (new User)->paginate(10);
return $this->exportOneSheet(
$users,
['first_name' => 'First name', 'last_name' => 'Last Name', 'gender' => 'Gender'],
'Users', 'users', 'xls', 'Creator', 'Company'
);
}
Function parameters
First parameter in \Illuminate\Pagination\LengthAwarePaginator
Second parameter is array with attribute name in db and title in export
Rest parameters are
title for document
filename for document
format for document (xsl,pdf etc.)
document creator
document company
Please see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING and CONDUCT for details.
The MIT License (MIT). Please see License File for more information.