Xgenious/ docs

Assets, Settings and Permissions

Assets

Put static files in your plugin's public/ folder and register them in boot():

use App\Plugins\Assets\StyleAsset;
use App\Plugins\Assets\ScriptAsset;

$context->assets()->style(new StyleAsset(handle: 'myplugin-admin', path: 'css/app.css', contexts: ['admin']));
$context->assets()->script(new ScriptAsset(handle: 'myplugin-js', path: 'js/app.js', contexts: ['user-dashboard']));

Files are served from /plugin-assets/{handle}/{path}?v={hash}, where the version hash changes whenever the file does, so browsers never use a stale copy.

OptionMeaning
handleA unique name for the asset.
pathPath inside the plugin's public/ directory.
contextsWhere to load it: admin, user-dashboard or frontend.
priority, dependsOnControl output order.
whenA callback that receives the request; return false to skip the asset.

The layouts print registered assets with @pluginAssets($context).

Tip

For small plugins you can skip assets entirely and put a @push('styles') block in your Blade view, as the first-party plugins do.

Settings

Plugin options are stored through HelpNest's static options:

$context->settings()->get('api_key');
$context->settings()->set('api_key', $value);

Use settings for site-wide plugin configuration chosen by the admin. For data that belongs to each customer (destinations, connections, preferences), create your own table in a plugin migration with a client_id column instead.

Permissions

Declare admin permissions in plugin.json:

{ "permissions": ["view", "manage"] }

On enable, HelpNest creates plugin.{id}.view and plugin.{id}.manage with the admin guard. On uninstall, they are removed. Use them to protect admin menu items and actions:

new MenuItem(id: 'myplugin.settings', label: 'My Plugin', route: 'plugin.my-plugin.admin.settings',
    permission: 'plugin.my-plugin.view');

$context->permissions()->getFullNames(); // ['plugin.my-plugin.view', 'plugin.my-plugin.manage']

Assign these permissions to roles from Admin → Admin Role Manage like any other permission.

Still stuck?
Our support team is ready to help you get set up.
Get support