Creating a button
app/Admin/Buttons/ChangeOrderStatusButton.php.
Registering a button
Assign the button to an admin model through the$buttons property.
app/Order.php
How the button is rendered
Once registered, the button appears in the side panel of every record.

Configuring the button
A button is a PHP class holding its properties and the method that runs when it is clicked.app/Admin/Buttons/ChangeOrderStatusButton.php
Type (required)
There are three types of action.
Name (required)
Class and colour
One offa-default, fa-primary, fa-success, fa-warning, fa-error.
Icon
Running the action
fire runs the action over a single record clicked from the side panel. fireMultiple only needs to be defined for actions that can run over several records. Both return a response in the form of a message or your own component.
app/Admin/Buttons/ChangeOrderStatusButton.php
Message title and text
To return plain text or HTML, use one ofmessage, success, error or warning.
Redirect
New window
Custom Vue or blade component
Create the component with
php artisan admin:component MyComponentName and choose the button component type.Actions with a confirmation
Sometimes the user has to be warned before an action runs. Thequestion method receives the confirmation request first and returns the confirmation response as a message or a component. Once confirmed, fire or fireMultiple runs.
The example below asks a question through a component with an input, whose value is then sent to fire.
app/Admin/Buttons/MyButton.php
resources/views/admin/components/FillAgeComponent.vue
app/Admin/Buttons/MyButton.php