Background Image

Upgrading

LaraAdmin is a template: your application is a copy of the LaraAdmin repository, with your own modules and changes on top. There is no package to composer update. Instead, you merge the new LaraAdmin version into your application with git, and resolve the places where LaraAdmin and you changed the same lines.

Add the LaraAdmin repository as a remote once:

git remote add laraadmin https://github.com/dwijitsolutions/laraadmin.git
git fetch laraadmin
git checkout -b upgrade/laraadmin-1.13.1
git merge laraadmin/master
composer install
php artisan migrate
./vendor/bin/phpunit

1.13.1 has no database changes. It adds config/backup.php, and changes the controller stub: generated controllers now check module access in dtajax(), return HTTP 404 for missing records and redirect create() to the index page. Make the same changes in the controllers of your own modules (see below), or your modules' listing data stays readable by any logged-in admin.

If you can't update a site right away, apply at least the registration fix by hand.

This moves your application from Laravel 8 and PHP 7.3/8.0 to Laravel 13 and PHP 8.3+. The application keeps the Laravel 8 directory structure (app/Http/Kernel.php, app/Console/Kernel.php, app/Exceptions/Handler.php), so you don't need to move your own code to the new Laravel skeleton.

If your repository was cloned from LaraAdmin, skip this step. If you copied the LaraAdmin 1.1.0 files into a new repository, git doesn't know that your first commit is LaraAdmin 1.1.0, and the merge in the next step would conflict on every file. Record it with a merge that changes no files:

# 94e4fc2 is "Release 1.1.0" in the LaraAdmin repository
git merge -s ours --allow-unrelated-histories -m "Link to LaraAdmin 1.1.0" 94e4fc26932c0ce326446cbcfbae31cf898edbc9

Use the LaraAdmin commit your site actually started from, if it isn't 1.1.0.

2. Merge LaraAdmin 1.13.1

git checkout -b upgrade/php84-laravel13
git merge laraadmin/master

Conflicts appear where you changed LaraAdmin's own files. The usual ones:

  • routes/admin.php, app/Providers/LAProvider.php and config/laraadmin.php: the code generator appended your modules' routes, observers and log types. Keep both sides, and keep the marker lines exactly as they are (see Architecture).
  • composer.json and composer.lock: take LaraAdmin's version, then add your own packages again and run composer update.
  • Built-in modules you customised (Employees, Customers, Blog...): keep your changes and also take the 1.13.1 access checks and fixes.

3. Dependencies

The merge brings LaraAdmin's composer.json. Compared with 1.1:

  • laravel/framework ^13.0, PHP ^8.3, PHPUnit 12, Sanctum 4, laravel/ui 4, spatie/laravel-backup 10, yajra/laravel-datatables-oracle 13.
  • laravelcollective/html is replaced by laraadmin/html ^7.0 (same Collective\Html namespace and Form:: API), and laraadmin/entrust is ^7.0. Both are loaded from GitHub through repositories entries.
  • fruitcake/laravel-cors, doctrine/dbal and facade/ignition are removed.

Then install and clear Laravel 8's cached provider lists:

rm -f bootstrap/cache/packages.php bootstrap/cache/services.php
composer install
php artisan migrate

LaraAdmin 1.13 has no new migrations, so migrate only runs your own pending ones.

4. Your own modules and code

The merge updates LaraAdmin's code, but not the controllers, models and views that the generator wrote for your modules. Update them by hand:

  • Models: remove protected $dates = ['deleted_at'];. SoftDeletes already casts deleted_at, and Laravel 13 no longer supports $dates.
  • Controllers, as in the new app/Stubs/controller.stub: start dtajax() with an access check, return the 404 page with status 404, and redirect create() to the index page:
    public function dtajax(Request $request)
    {
        if (! LAModule::hasAccess('Courses', 'view')) {
            return response()->json(['status' => 'error', 'message' => 'Unauthorized Access'], 403);
        }
        ...
    
    return response()->view('errors.404', ['record_id' => $id, 'record_name' => ucfirst('course')], 404);
  • Doctrine is gone. Search app/ and resources/views for getDoctrine. Read columns with Schema::getColumns($table) and foreign keys with Schema::getForeignKeys($table). Column changes in your own migrations use ->change(), which must now restate the whole column (type, length, nullable, default).
  • double() no longer takes a precision: $table->double('price', 15, 2) becomes $table->double('price') (or use decimal()).
  • Laravel 13 renamed the CSRF middleware: App\Http\Middleware\VerifyCsrfToken now extends PreventRequestForgery. The merge brings this; check your $except list survived.
  • Your own packages need Laravel 13 versions. Follow Laravel's upgrade guides from 9 to 13 for any other framework feature you use.

Alternatively, if you never changed a module's generated files, open the module in Module Manager and click Update Module: it regenerates the controller, model, observer, views and language file from the new stubs. It overwrites those files, so only use it for untouched modules.

5. Check and deploy

  • Set MAIL_FROM_ADDRESS in .env: the site doesn't boot without it.
  • Run the tests (./vendor/bin/phpunit with a laraadmin_test MySQL database), then click through your own modules: list, add, edit, view and delete a record as the Super Admin and as a restricted role.
  • To see the PHP deprecations your own code still triggers, set LOG_DEPRECATIONS_CHANNEL=single and watch storage/logs/laravel.log.
  • On the server: PHP 8.3 or 8.4, composer install --no-dev, php artisan migrate --force, then php artisan config:cache, route:cache and view:cache.
  • Check the users table for accounts you don't recognise (see the registration issue).

Behaviour that changes for your users:

  • New Currency columns are DOUBLE instead of DOUBLE(15,2). Existing columns are not changed.
  • Changing a field's type to Integer makes the column NOT NULL, the same as creating one.
  • Users stay logged in: sessions keep PHP serialization.

LaraAdmin 1.0 was the dwij/laraadmin package, installed with php artisan la:install into Laravel 5.2–5.4. There is no automatic path from it to 1.13. Start a new application from LaraAdmin 1.13.1, copy your modules' migrations (change Module::generate to LAModule::generate; the 1.0 field arrays still work, but the 1.13 field format is easier to read), run them, generate the CRUDs, and move your data and custom code over. The 1.0 upgrade page covers updates within 1.0.


What's Next ?