Skip to main content

Custom Fields

This is a term you will find in WordPress, where WordPress allows users to add additional information when writing a post. We take this same concept and apply it to any of the different modules within your own app.

You can add new fields per your requirements. These fields will be available to all the users added to your organization's app.

For almost all of the fields that you create, you need to specify the following:

  • Label: Specify a name for the field
  • Field Properties: Specify properties of the field such as description, field values and so on

Field Properties are required to be one of the following field types:

Field TypeOther Details
TextLength: Maximum 255 characters are allowed.
IntegerLength: Maximum 9 digits are allowed.
Date & TimeFormat: YYYY/MM/DD HH:MM Note: Date format will be changed according to user's time zone settings.
EmailSpecify a valid email address
Pick listPick List Values: Specify the pick list values
Multi-select Pick listPick List Values: Specify the pick list values
Text AreaSpecify the character limit: Small is 2000 characters, Large is 32000 characters.

Text Area Large will not be available while adding criteria in any feature.

Both Text Area Large and Small cannot be used for sorting records in ascending or descending order.


How to Add a Custom Field#

First, you need to activate a custom field on any model by using Baka\Contracts\CustomFields\CustomFieldsTrait

This will give you the following functionalities

  • set(name, value)
  • get(name)
  • getAll()
  • create(name)

So you can add any field you want to this model, this will save it to the DB and Redis for faster performance.

Also for your API CRUDs, you will need to have its controller implement the trait CrudCustomFieldsBehaviorTrait. If you want to do it yourself just make sure to call the function


before saving the entity.

By version 0.1.5 of Kanvas you can also create this dynamic field via its web UI

Note: Custom Fields Search will use Elasticsearch

Complex Filter (0.2.5)