This package is used to export and import users in the .csv
format.
composer require escolalms/csv-users
php artisan db:seed --class="EscolaLms\CsvUsers\Database\Seeders\CsvUsersPermissionSeeder"
id | name | first_name | last_name | country | is_active | created_at | onboarding_completed | email_verified | interests | avatar | roles | permissions | path_avatar | contact | bio | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
16 | Valentine Wehnner | Valentine | Wehnner | [email protected] | Poland | 2021-10-14T15:50:28.000000Z | TRUE | TRUE | LMS | localhost/storage/avatars/16/logo.png | ["tutor"] | ["access dashboard"] | avatars/16/logo.png | 1234567 | bio |
-
Export uses fields from
EscolaLms\Auth\Http\Resources\UserFullResource
-
Import uses the
update
orcreate
method fromEscolaLms\Auth\Repositories\Contracts\UserRepositoryContract
. If the email exists in the database, the user's data is updated. Otherwise, a new user is created.
All the endpoints are defined in
Run ./vendor/bin/phpunit
to run tests. Test details
EscolaLms\CsvUsers\Events\EscolaLmsImportedNewUserTemplateEvent
=> Event is dispatched after importing a new user.
Permissions are defined in seeder