Get started with building extension add-ons for Nova
AddonServiceProvider.php
file in a Providers
directory that extends the Nova\AddonServiceProvider
classAddon.php
file that extends the Nova\Addons\Extension
classaddons
table in the database for tracking the add-on. Instead of trying to hook into the database events, Nova provides a way to build all of the necessary logic and steps that you may need to ensure your add-on is working as intended.
To create an install script for your add-on, you can define an install()
method in the Addon.php
file at the root of your add-on.
From inside the install()
method, you can do whatever work you need to do in order to install and setup your add-on. Most often, this will include running database migrations to ensure the database is in the correct state, but there may be other things you need to do in addition to that.
uninstall()
method in the Addon.php
file at the root of your add-on.
From inside the uninstall()
method, you can do whatever work you need to do in order to remove your add-on from the site. Most often, this will include rolling back database migrations to ensure the database is in the correct state, but there may be other things you need to do in addition to that.
update()
method in the Addon.php
file at the root of your add-on.
From inside the update()
method, you can do whatever work you need to do in order to update your add-on to the latest version. Most often, this will include running database migrations to ensure the database is in the correct state, but there may be other things you need to do in addition to that.
ranks
directory with the version from the add-on’s assets
folder. This will leave any image it does not find in the add-on’s assets
folder alone, thus preserving any custom images you’ve added to your ranks
directory.
ranks
directory with the version from the add-on’s assets
folder. This will leave any image it does not find in the add-on’s assets
folder alone, thus preserving any custom images you’ve added to your ranks
directory.