Assign-Without-Account
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:
http
POST /api/admin/user-submissions
json
{
"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
List of user submissions
Permissions
Permissions are defined in seeder