Instance Actions
In the user interface instanceActions are buttons that trigger an action relative to a table and a specific line
Here is the code needed to add this button to the user interface
Config
instanceActions is an array of objects, each object representing an action, here are the parameters for each action
name
Name of the action, this will be used to identify the action, must be unique for the model
e.g. the API endpoint generated will look like this if name = ‘duplicate-idea’, and the id of the row is 1
POST /adomin/api/actions/Idea/duplicate-idea/1
tooltip
Tooltip shown on the frontend, when hovering the button
icon
Icon name, by default this uses Tabler icons
You can browse the list of available icons at: https://tabler.io/icons
iconColor
Color of the icon, this will be passed as the css color property, so you can use any valid css color
action
Function to execute when the action is triggered
It will be called with the http context as a parameter
You are in charge of doing authorization checks if you want to restrict which backoffice users can use this action
Your action function will receive the model instance primary key inside the params
object like this