Creating An Application Type
Creating An Application Type Category
Application types are grouped together using categories. Therefore, before you can create an application type, you need to create a category. To create a new category, you can use the following command:
php artisan paperless:category
The command will ask you for the slug of the category and the label. The slug is used to identify the category in the database.
Creating An Application Type
Once you have created a category, you can create an application type. To create a new application type, you can use the following command:
php artisan paperless:type
The command will ask you for the following information:
- The name of the application type
- The category of the application type
- The entity types that can apply for the application type
The command will create the following files:
- A super class for the application type in the
app/Paperless/ApplicationTypes
directory - A class for defining the application type fields in the
app/Paperless/FieldDefinitions
directory - A service class for the application type in the
app/Paperless/Services
directory
Adding Fields To The Application Type
Open up the field definition class created for the application type in the app/Paperless/FieldDefinitions
directory.
The class will have a static getFields
method that returns an array of field definitions.
You may use the following value objects to define the fields
Javaabu\Paperless\Support\ValueObjects\SectionDefinition
Javaabu\Paperless\Support\ValueObjects\FieldGroupDefinition
Javaabu\Paperless\Support\ValueObjects\FieldDefinition
Note that FieldDefinition
objects can be nested within SectionDefinition
and FieldGroupDefinition
objects to create a nested structure of fields. and FieldGroupDefinition
objects can be nested within SectionDefinition
objects to create a nested structure of field groups.
After defining the fields, you can run the following commands to seed the application type with the fields and to seed the necessary permissions.
php artisan db:seed --class=ApplicationTypesSeeder
php artisan db:seed --class=ApplicationTypesPermissionsSeeder
Optionally, you can seed the roles again to ensure that the new permissions are added to the roles.
php artisan db:seed --class=RolesSeeder