Skip to content

Package: assign-without-account

Generated from api/packages/assign-without-account

Source: api/packages/assign-without-account · imported version 0.1.18. The sections after the README are extracted from the code on every docs build.

The package is used to assign users without an account.

  • composer require ulams/assing-without-account
  • php artisan migrate
  • php artisan db:seed --class="Ulams\AssignWithoutAccount\Database\Seeders\AssignWitoutAccountPermissionSeeder"

You need to define email templates in the Templates package for AssignToProduct and AssignToProductable events.

  1. user-submissions
id email 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 Ulams\Cart\Models\Product 2
  1. Create user submission like this:
POST /api/admin/user-submissions
{
"email": "test@email.com",
"morphable_id": 2,
"morphable_type": "Ulams\\Cart\\Models\\Product"
}
  1. Create a new account.
  2. The product is assigned to your account.

All the endpoints are defined in swagger

Run ./vendor/bin/phpunit to run tests. See tests folder as it’s quite good staring point as documentation appendix.

Test details Tests PHPUnit in environments

  1. AssignToProduct - event dispatched after assigning user to product.
  2. AssignToProductable - event dispatched after assigning user to productable model.
  1. AccountRegisteredListener - listens to newly created accounts.

List of user submissions List of stationary events

Permissions are defined in seeder

Method Path Auth Action
GET /api/admin/user-submissions yes UserSubmissionAdminController@index
POST /api/admin/user-submissions yes UserSubmissionAdminController@create
PUT /api/admin/user-submissions/{id} yes UserSubmissionAdminController@update
DELETE /api/admin/user-submissions/{id} yes UserSubmissionAdminController@delete
Permission Seeded for roles Constant
assign-without-account_user-submission_list admin AssignWithoutAccountPermissionEnum::USER_SUBMISSION_LIST
assign-without-account_user-submission_create admin AssignWithoutAccountPermissionEnum::USER_SUBMISSION_CREATE
assign-without-account_user-submission_update admin AssignWithoutAccountPermissionEnum::USER_SUBMISSION_UPDATE
assign-without-account_user-submission_delete admin AssignWithoutAccountPermissionEnum::USER_SUBMISSION_DELETE

Registered with AdministrableConfig::registerConfig (editable in the admin panel under Configuration → Settings).

None.

Event Description Notification templates
AssignToProduct Email
AssignToProductable Email
UnassignProduct Email
UnassignProductable Email

None.

None.

None.

None.