Upgrading To 3.x from 2.x
High-Impact Changes
Laravel 6.0 support was ended
Dragon Code: Contracts (
dragon-code/contracts) support was ended
Minor-Impact Changes
The easiest way to upgrade
For your convenience, we have created an upgrade console command:
It will do the following:
Change the namespace of the abstract class
Add a strict type declaration
Replace the
upmethod with__invokeif the class does not have adownmethodReplace named classes with anonymous ones
Create a configuration file according to the data saved in your project
Changes properties from
snake_casetocamelCase
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:
Configuration
Publish the config file and migrate the settings from the config/database.php file to config/actions.php.
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:
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:
After: