From: Louis Jeckel Date: Wed, 7 Apr 2021 10:19:57 +0000 (+0200) Subject: export users X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=07ec2246a7ea1d91d05a2a1fbd790e0b5dc94a3a;p=psq.git export users --- diff --git a/app/Nova/Actions/ExportUsersToExcel.php b/app/Nova/Actions/ExportUsersToExcel.php new file mode 100644 index 0000000..33857dc --- /dev/null +++ b/app/Nova/Actions/ExportUsersToExcel.php @@ -0,0 +1,60 @@ +first_name, + $user->last_name, + $user->email, + $user->address_line_1, + $user->city, + $user->postal_code, + $user->country, + $user->phone, + (string) $user->organization + + + ]; + } + + public function headings(): array + { + return [ + 'Prénom', + 'Nom', + 'Email', + 'Adresse', + 'Ville', + 'Code Postal', + 'Pays', + 'Téléphone', + 'Organisation' + + ]; + } + +} diff --git a/app/Nova/User.php b/app/Nova/User.php index e2d013b..f455fb9 100644 --- a/app/Nova/User.php +++ b/app/Nova/User.php @@ -3,6 +3,7 @@ namespace App\Nova; use App\MailgunEvent; +use App\Nova\Actions\ExportUsersToExcel; use App\Nova\Actions\ImportUsers; use App\Nova\Actions\SendCustomNotification; use App\Nova\Actions\SendNotification; @@ -38,6 +39,7 @@ use Laravel\Nova\Fields\Text; use Laravel\Nova\Http\Requests\NovaRequest; use Laravel\Nova\Panel; use Laravel\Nova\Tests\Fixtures\Profile; +use Maatwebsite\LaravelNovaExcel\Actions\DownloadExcel; class User extends Resource { @@ -202,6 +204,7 @@ class User extends Resource public function actions(Request $request) { return array_merge([ + new ExportUsersToExcel, new ImportUsers, new SendNotification, new StartTrial, diff --git a/composer.json b/composer.json index 58e7a5a..023bcef 100644 --- a/composer.json +++ b/composer.json @@ -36,6 +36,7 @@ "league/glide": "^1.5", "league/glide-laravel": "^1.0", "league/html-to-markdown": "^4.9", + "maatwebsite/laravel-nova-excel": "^1.2", "mailgun/mailgun-php": "^3.0", "masterminds/html5": "^2.7", "numaxlab/nova-ckeditor5-classic": "^1.1", diff --git a/composer.lock b/composer.lock index eea0e96..8a1db8f 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "a63ddd7c0e259fef66125fa383140abb", + "content-hash": "8f33d2bbf6bc00c0cb50b2151651b430", "packages": [ { "name": "algolia/algoliasearch-client-php", @@ -3721,6 +3721,67 @@ }, "time": "2021-01-06T19:20:22+00:00" }, + { + "name": "laravie/serialize-queries", + "version": "v0.2.3", + "source": { + "type": "git", + "url": "https://github.com/laravie/serialize-queries.git", + "reference": "0b73889e102db6708d64ff003b028b42687ceeb4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laravie/serialize-queries/zipball/0b73889e102db6708d64ff003b028b42687ceeb4", + "reference": "0b73889e102db6708d64ff003b028b42687ceeb4", + "shasum": "" + }, + "require": { + "illuminate/database": "^5.8 || ^6.0 || ^7.0 || ^8.0", + "illuminate/queue": "^5.8 || ^6.0 || ^7.0 || ^8.0", + "opis/closure": "^3.4.2", + "php": ">=7.1" + }, + "require-dev": { + "orchestra/testbench": "^3.8 || ^4.0 || ^5.0 || ^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Laravie\\SerializesQuery\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mior Muhammad Zaki", + "email": "crynobone@gmail.com" + } + ], + "description": "Serializable Laravel Query Builder", + "support": { + "issues": "https://github.com/laravie/serialize-queries/issues", + "source": "https://github.com/laravie/serialize-queries/tree/v0.2.3" + }, + "funding": [ + { + "url": "https://paypal.me/crynobone", + "type": "custom" + }, + { + "url": "https://liberapay.com/crynobone", + "type": "liberapay" + } + ], + "time": "2020-10-25T04:39:37+00:00" + }, { "name": "league/commonmark", "version": "1.5.7", @@ -4466,6 +4527,64 @@ ], "time": "2020-11-27T16:17:38+00:00" }, + { + "name": "maatwebsite/laravel-nova-excel", + "version": "1.2.3", + "source": { + "type": "git", + "url": "https://github.com/Maatwebsite/Laravel-Nova-Excel.git", + "reference": "12a696e53be79e0f212c089abaa5f248d74eeb13" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Maatwebsite/Laravel-Nova-Excel/zipball/12a696e53be79e0f212c089abaa5f248d74eeb13", + "reference": "12a696e53be79e0f212c089abaa5f248d74eeb13", + "shasum": "" + }, + "require": { + "laravel/nova": "*", + "laravie/serialize-queries": "^0.2", + "maatwebsite/excel": "^3.1", + "php": ">=7.1.0" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Maatwebsite\\LaravelNovaExcel\\LaravelNovaExcelServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Maatwebsite\\LaravelNovaExcel\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Patrick Brouwers", + "email": "patrick@maatwebsite.nl" + } + ], + "description": "Supercharged Excel exports for Laravel Nova Resources", + "keywords": [ + "PHPExcel", + "actions", + "laravel", + "laravel-nova", + "nova", + "phpspreadsheet" + ], + "support": { + "issues": "https://github.com/Maatwebsite/Laravel-Nova-Excel/issues", + "source": "https://github.com/Maatwebsite/Laravel-Nova-Excel/tree/1.2.3" + }, + "time": "2020-10-08T14:10:40+00:00" + }, { "name": "maennchen/zipstream-php", "version": "2.1.0",