escolalms / assign-without-account
Escola Headless LMS Assign without account
Installs: 9 397
Dependents: 2
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 0
Type:package
pkg:composer/escolalms/assign-without-account
Requires
- php: >=7.4
- escolalms/cart: ^0
- escolalms/core: ^1.2.2
- laravel/framework: >=8
Requires (Dev)
- escolalms/auth: ^0
- escolalms/templates: ^0
- orchestra/testbench: ^6
- phpunit/phpunit: ^9.0
README
What does it do
The package is used to assign users without an account.
Installing
- composer require escolalms/assing-without-account
- php artisan migrate
- php artisan db:seed --class="EscolaLms\AssignWithoutAccount\Database\Seeders\AssignWitoutAccountPermissionSeeder"
Requirements
You need to define email templates in the Templates package for AssignToProduct and AssignToProductable events.
Database
- user-submissions
| id | status | created_at | updated_at | morphable_type | morphable_id | |
|---|---|---|---|---|---|---|
| 1 | test@email.com | sent | 2022-04-15 07:36:12 | 2022-04-15 07:36:12 | App\Models\Course | 1 | 
| 2 | test@email.com | accepted | 2022-04-15 07:36:30 | 2022-04-15 07:36:30 | EscolaLms\Cart\Models\Product | 2 | 
Example
- Create user submission like this:
POST /api/admin/user-submissions
{
    "email": "test@email.com",
    "morphable_id": 2,
    "morphable_type": "EscolaLms\\Cart\\Models\\Product"
}
- Create a new account.
- The product is assigned to your account.
Endpoints
All the endpoints are defined in swagger
Tests
Run ./vendor/bin/phpunit to run tests. See tests folder as it's quite good staring point as documentation appendix.
Events
- AssignToProduct- event dispatched after assigning user to product.
- AssignToProductable- event dispatched after assigning user to productable model.
Listeners
- AccountRegisteredListener- listens to newly created accounts.
How to use this on frontend.
Admin panel
Permissions
Permissions are defined in seeder
