Nova Requests
You may use theNova.request() method to make XHR requests to backend routes provided by your application or custom tools, cards, and fields. The Nova.request() method is powered by Axios and offers the same API. However, the Nova.request() method configures its own instance of Axios that has pre-configured interceptors to properly handle and redirect on 401, 403, and 500 level HTTP server responses:
Manual Navigation
The globalNova JavaScript object offers a visit method that may be invoked to navigate to other URLs within your Nova dashboard:
visit method accepts an array of navigation options as its second argument. As the visit method uses Inertia’s own visit method behind the scenes, all of Inertia’s visit options are supported by Nova’s visit method:
Event Bus
The globalNova JavaScript object may be used as an event bus by your custom components. The bus provides the following methods, which correspond to and have the same behavior as the event methods provided by tiny-emitter:
Notifications
You may display toast notification to users of your custom frontend components by calling thesuccess, error, info, or warning methods on the global Nova object:
Shortcuts
Nova provides two convenience methods for managing keyboard shortcuts, powered by Mousetrap. You may use these methods within your custom components to register and unregister shortcuts:Global Variables
The globalNova JavaScript object’s config method allows you to get the current Nova base path and userId configuration values:
Nova::provideToScript method. You may call this method within a Nova::serving listener, which should typically be registered in the boot method of your application or custom component’s service provider:
provideToScript method, you may access it using the global Nova JavaScript object’s config method:
Localizations
Localization strings can be passed to the frontend via yourNovaServiceProvider. To learn more, please consult the full custom localization documentation.
Using Nova Mixins
Custom Nova tools, resource tools, cards, and other custom packages that are being developed within anova-components directory of a Laravel application can reference Nova’s own packages.js file by defining a laravel-nova alias that points to this file within the Nova installation that is located within your root application’s vendor directory. This alias should be placed in your package’s nova.mix.js:
nova-components directory should declare laravel/nova as a “dev” Composer dependency. Then, define a laravel-nova Mix alias that points to the packages.js file within your custom package’s vendor directory:
laravel-nova mixins you are required to prepare laravel/nova’s node_modules by running the following command:
Laravel Nova’s assets are built using lockfile version
3 and require NPM 9+.