Skip to content

AM2studio/Laravel-Exporter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel-Laravel-Exporter

Package contains trait for exporting documents

Install

Via Composer

$ composer require am2studio/laravel-exporter

Usage

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

Change log

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING and CONDUCT for details.

License

The MIT License (MIT). Please see License File for more information.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages