Link
Description
The "Link" module purpose - render a link button to some route in Laravel app, or to some page in Adminix panel.
Configuration
To add to the page Link to some page in your Adminix panel, you need paste AlexKudrya\Adminix\Modules\Link\AdminixLinkModule class instance as an argument to addModule or addModules method of AdminixPage object. This link used only for navigation between adminix pages, difened in adminix config file
To add to the page Link to some page outside the Adminix panel, but in your Laravel Application, you need paste AlexKudrya\Adminix\Modules\Link\LinkModule class instance as an argument to addModule or addModules method of AdminixPage object. This link used to access any route in your Laravel application (route must be named and optionally protected by AlexKudrya\Adminix\Http\Middleware\AuthMiddleware. Use this middleware only after web and auth middlewares)
LinkModule and AdminixLinkModule implement the shared Actions metadata contract. Use actionMetadata() when a custom renderer or extension needs the common action fields.
For non-GET methods LinkModule renders a form with CSRF protection. PUT, PATCH, and DELETE use a POST form with Laravel method spoofing.
LinkModule can also render small forms before the submit button by adding shared ActionField fields:
Field names are submitted directly to the application route, for example csv_file, dry_run, and analyze. File fields automatically enable multipart/form-data; boolean fields render as Adminix switch controls and submit 0/1.
AdminixLinkModule and LinkModule configurations
Method | Description | |
|---|---|---|
name | Name of module, must be unique in current page.
name('user_cart_btn')
| Required |
uri | In case
uri(UserCartPage::URI)
In case
uri('user_account')
| Required |
title | Title which will be displayed on the button
name('USER CART')
| Optional |
icon | Icon class name from Bootsrap icons Example: to generate in the Link an icon
icon('bi bi-cart3')
| Optional |
method | Type of HTTP request, can be provided only by In case In case By default, it is equal to
method(HttpMethodsEnum::POST)
| Optional |
params | It is the list of parameters added to the link. For new pages, link url will be Example:
params(['param:0'])
Legacy one-based page providers that use | Optional |
Shared action metadata methods:
tooltip()stores hover text.criteria()controls row action visibility when the link is used insideListModule.confirm()stores a confirmation message for state-changing links.color()stores an optionalColorsEnumvalue or CSS color string for custom renderers.destructive()marks dangerous actions without changing the current route contract.actionMetadata()returnsActionMetadataDto.
Appearance example
