Upgrading
Follow the instructions for upgrading a Laravel application, while bearing the following in mind...
7.x to 8.x (12 Jul 2022)
This update is for compatibility with alberon/webpack 2.0.
6.x to 7.x (16 Feb 2022)
This update is for compatibility with Laravel 9. It includes updates to:
- Laravel Breadcrumbs 7
- Laravel Enum 5 (remove
CastsEnums) - Symfony Filesystem 6
-
- Inertia Progress 0.2
- Inertia Vue 0.8
- Linkify 3
The changes required are:
-
When prompted by the upgrade script, remove the
vue-metaJavaScript package. -
Update all files from the template as normal.
-
Replace
Nexus::shareOnce()withNexus::config(), and change any Vue code that uses them from$page.props.<name>to$config.<name>(it's no longer possible to merge props, plus this makes it clearer). (Example here) -
If
LayoutMain.vueis being overriden, update it to match the package - addHasPageTitleandHead, and remove thehead()method.- If there are any custom layouts, do the same.
-
In the tests, replace
assertComponent(),assertProp(),assertPropCount()andassertPropExists()(or direct calls toinertiaComponent()andinertiaProps()) with the official test helpers. -
Replace any calls to
Redirect::hard()withInertia::location(). -
If any components implement a custom
head()method or object for Vue Meta, replace it with the new Inertia.js<Head>component.
These changes are optional (but recommended for consistency / forwards compatibility):
-
Use the new
<Link>component instead of<InertiaLink>. You will need to import it, as it is not globally available. (The global registration of<InertiaLink>will be removed in a future version of Nexus.) -
Replace calls to
Inertia::render()with the global helper functioninertia(). (Both are supported, but this is shorter and consistent withview().) -
If any forms have uploads, you no longer need to manually create a
FormDataobject
Package updates required:
- alberon/nexus-generator: 2.0+ (optional)
- alberon/nexus-users: 6.0+
Other things to be aware of:
- Inertia now defines
$props.errorsfor us, but it only includes the first validation error message (as a string instead of an array). This is unlikely to be a problem in practice.
Updating Packages
If you are working on any of the Nexus packages, make the same changes as listed above.
You may also need to register the Vue namespace in the tests if you use the component() helper.
5.x to 6.x (8 Oct 2021)
Chart.js was upgraded from v2 to v3 - see the Migration Guide if the project is using it.
4.x to 5.x (18 Sep 2021)
This release adds xxl, xxxl and xxxxl breakpoints and modal sizes.
The xl modal width was reverted from 97vw to the Bootstrap default of 1140px. Any existing xl size modals should be replaced with fluid size (up to 2000px), unless a smaller size works better.
4.0.x to 4.0.3+ (17 Nov 2020)
This is a bugfix release but it requires the following changes to the application:
-
Add
\Alberon\Nexus\Http\Middleware\HandleInertiaRequests::classtoapp/Http/Kernel.php. -
Remove the
Inertia::version()section fromapp/Providers/InertiaServiceProvider.php(not strictly necessary, but it's no longer needed).
3.x to 4.x (12 Nov 2020)
This release splits the main entrypoint into nexus and frontend (if using Nexus CMS), and moves more of the code from the template into the package (taking advantage of component overriding to allow customisations).
The changes required are:
-
Update
webpack.config.jsfrom the template. -
Update the
resources/css/andresources/js/folders to match the template. Move any customisations to overrides inresources/nexus/(see here). -
Move
resources/Shared/LayoutSidebar.vuetoresources/nexus/vue/LayoutSidebar.vue. -
Either move
LayoutMain,LayoutNavbarandLayoutNavbarLogotoresources/nexus/vue/as well (if they have been customised), or just delete them (if they haven't). -
If it wasn't deleted, check
resources/nexus/vue/LayoutNavbarLogo.vueagainst the default - specifically, the colour of the spinner was changed fromtext-warningclass to a custom class withcolor: $yellow, and the link was changed from/to$route('nexus.home'). -
Search for
@/vue/Shared/Layoutinresources/- replace with@alberon/nexus/vue/Layout. -
Search for
<CardTableinresources/- replace anyv-model="..."props with:rows="..."(becausev-modelnow maps toselected-idsto support bulk actions). -
Move
resources/views/layouts/_head.blade.php(the Sentry code) toresources/nexus/views/layouts/head/_before_scripts.blade.php. (Note: If you are going to use Nexus CMS, the new template includes a replacementresources/views/layouts/_head.blade.phpthat is for the frontend, not for Nexus.) -
Delete
resources/views/errors/(or move toresources/nexus/views/errors/if they have been customised). -
Delete
resources/vue/Errors/(or move toresources/nexus/vue/Errors/to override the default). -
Update the
App\Exceptions\Handlerclass from the template - it should now extendAlberon\Nexus\Exceptions\Handlerinstead ofIlluminate\Foundation\Exceptions\Handler, and some code has been moved into that parent class. -
Delete
resources/vue/Dashboard/PagePlaceholder.vue(or move it toresources/nexus/vue/Home/PagePlaceholder.vueto override the default). -
In
resources/nexus/vue/LayoutSidebar.vue, changedashboardtonexus.homein theactiveandhrefattributes, and removev-if="$hasRoute('dashboard')"(comment out the link if there is no dashboard). -
In
routes/web.php, changename('dashboard')toname('nexus.home'), and remove thedashboard.placeholderline completely (whether it's commented out or not). -
If there are still any references to
$date()in Vue (which was deprecated in Nexus 1), replace them with the<FormatDateTime>component (or use the date-fns format() function directly).
Package updates required:
- alberon/nexus-demo: 4.0+
- alberon/nexus-users: 4.0+
Other changes to be aware of:
-
.text-warningwas changed from yellow to orange to make it more readable. If you've used it on a dark background, switch to a custom class withcolor: $yellow(or similar). -
Coloured table rows (
.table-danger, etc.) are now lighter to make them more readable. -
Inertia.js was updated - it includes some deprecations which may be displayed in the console.
-
Added vue-unique-id (
$uidand$id()) for generating unique HTML IDs.
Updating Packages
If you are working on any of the Nexus packages:
-
All routes should be wrapped in
Route::prefix(config('nexus.prefix'))(example). -
Replace
@/vue/Shared/LayoutMainwith@alberon/nexus/vue/LayoutMain. -
Replace
@/css/shared/commonwith@alberon/nexus/css/common. -
Replace
DaveJamesMiller\Breadcrumbs\BreadcrumbsGeneratorwithDiglactic\Breadcrumbs\Generator. (More details) -
Use vue-unique-id (
$uidand$id()) for generating unique HTML IDs.
2.x to 3.x (2 Nov 2020)
This release adds support for overriding Nexus functionality in an application, particularly for the CMS & Users packages.
-
The User model moved from
App\Models\UsertoApp\NexusUsers\Models\User(because all overrides will be namespaced). You will need to update any references to it. -
App\Models\PermissionandApp\Models\Roleare no longer required. If they do need to be overridden, they should be moved toApp\NexusUsers\Models\like theUsermodel (see the article above). -
The prefix for JS/CSS imports changed from
alberon-nexus/to@alberon/nexus/(consistent with npm namespaces). You will need to search/replace inresources/(CSS, JS, Vue files). -
The prefix for namespaced Inertia pages changed from
alberon-nexus::to justnexus::(for consistency with other packages like breadcrumbs). You will need to search and replace inresources/views/.
Package updates required:
- alberon/nexus-demo: 3.0.1+
- alberon/nexus-users: 3.0+
Optional but recommended:
-
Change any
canprops touserCanfor consistency / clarity. -
In sections, change
section.cantosection_userCan(use_instead of nesting for namespacing, to allow partial reloads). -
In packages, change
alberonNexusDemo.cantonexusDemo_userCan(remove thealberonprefix for simplicity, and ).
Updating Packages
If you are working on any of the Nexus packages you also need to be aware of the following:
-
Imports should now always use the full
'@alberon/nexus/vue/Example.vue'syntax rather than relative paths like'./Example.vue'(to allow them to be overridden). -
Dynamic components were changed a bit to be consistent with component overriding.
1.x to 2.x (9 Oct 2020)
This update is for compatibility with Laravel 8 and Inertia-Vue 0.3.0.
In resources/vue, you will need to:
- Search and replace
$page.with$page.props.(details) - Recommended: Search and replace
$page.props.propswith$page.propsto make sure you didn't change anything twice - Recommended: Search and replace
$inertia.pagewith$page
Package updates required:
- alberon/nexus-demo: 2.0+
- alberon/nexus-users: 2.0+
FYI: I also removed a number of "Example" files from the template repo. Going forward, the Nexus Demo Application will contain the examples, with additional documentation on the Knowledge Base as needed.
0.x to 1.x (14 Aug 2020)
This is when we started moving functionality from the Template Sites repo into individual packages, including Nexus.
The few sites that were using it have been upgraded already, so I won't write detailed instructions here, but you can have a look at this revision of the Laravel upgrade instructions to see what changed. (Note: Some of the changes were Nexus-specific, while others affect all Laravel applications.)