Skip to content
On this page

CSV-Users

swaggercodecovphpunitdownloadsdownloadsdownloadsMaintainabilityTest Coverage

What does it do

This package is used to export and import users in the .csv format.

Installation

  • composer require escolalms/csv-users
  • php artisan db:seed --class="EscolaLms\CsvUsers\Database\Seeders\CsvUsersPermissionSeeder"

Example

idnamefirst_namelast_nameemailcountryis_activecreated_atonboarding_completedemail_verifiedinterestsavatarrolespermissionspath_avatarcontactbio
16Valentine WehnnerValentineWehnnerjhyatt@example.netPoland2021-10-14T15:50:28.000000ZTRUETRUELMSlocalhost/storage/avatars/16/logo.png["tutor"]["access dashboard"]avatars/16/logo.png1234567bio
  • Export uses fields from EscolaLms\Auth\Http\Resources\UserFullResource

  • Import uses the update or create method from EscolaLms\Auth\Repositories\Contracts\UserRepositoryContract. If the email exists in the database, the user's data is updated. Otherwise, a new user is created.

Endpoints

All the endpoints are defined in swagger

Tests

Run ./vendor/bin/phpunit to run tests. Test details codecovphpunit

Events

  • EscolaLms\CsvUsers\Events\EscolaLmsImportedNewUserTemplateEvent => Event is dispatched after importing a new user.

How to use this on frontend

Admin panel

Import and export buttonImport / export button

Permissions

Permissions are defined in seeder