Laravel Deploy Operations 7.x Help

Upgrading To 3.x from 2.x

High-Impact Changes

  1. Updating Dependencies

  2. Configuration

  3. Anonymous Classes

  4. Parent Namespace

  5. Changed Properties

  6. Added recursive search for actions in a folder

  7. PHP 8.0.2 Required

  8. Laravel 6.0 support was ended

  9. Dragon Code: Contracts (dragon-code/contracts) support was ended

Minor-Impact Changes

  1. Changed Action Repository

  2. Actions Location

The easiest way to upgrade

For your convenience, we have created an upgrade console command:

composer require dragon-code/laravel-migration-actions:^3.0 php artisan migrate:actions:upgrade php artisan migrate

It will do the following:

  • Change the namespace of the abstract class

  • Add a strict type declaration

  • Replace the up method with __invoke if the class does not have a down method

  • Replace named classes with anonymous ones

  • Create a configuration file according to the data saved in your project

  • Changes properties from snake_case to camelCase

Updating Dependencies

PHP 8.0.2 Required

Deploy Actions for Laravel now requires PHP 8.0.2 or greater.

Composer Dependencies

You should update the following dependency in your application's composer.json file:

{ "require": { "dragon-code/laravel-migration-actions": "^3.0" } }

Configuration

Publish the config file and migrate the settings from the config/database.php file to config/actions.php.

php artisan vendor:publish --provider="DragonCode\LaravelActions\ServiceProvider"

Actions Location

Move the action files to the actions folder in the project root, or update the actions.path option in the configuration file.

Parent Namespace

Replace DragonCode\LaravelActions\Support\Actionable with DragonCode\LaravelActions\Action.

Anonymous Classes

Replace named calls to your application's classes with anonymous ones.

For example:

// before use DragonCode\LaravelActions\Support\Actionable; class Some extends Actionable { } // after use DragonCode\LaravelActions\Action; return new class extends Action { };

Invokable Method

If your class does not contain a down method, then you can replace the up method with __invoke.

Changed Action Repository

Just call the php artisan migrate command to make changes to the action repository table.

Changed Properties

Make sure all overridden properties are typed:

New Name

Old Name

protected bool $once

protected $once

protected bool $transactions

protected $transactions

protected int $transactionAttempts

protected $transaction_attempts

protected string\|array\|null $environment

protected $environment

protected string\|array\|null $exceptEnvironment

protected $except_environment

protected bool $before

protected $before

Added recursive search for actions in a folder

Before:

2022_10_13_013321_test1 2022_10_13_013326_test2 bar/2022_10_13_013323_test3 # will not be called

After:

2022_10_13_013321_test1 2022_10_13_013326_test2 bar/2022_10_13_013323_test3 # will be called
02 April 2025