You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+46-2Lines changed: 46 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,7 +30,7 @@ Or manually update `require` block of `composer.json` and run `composer update`.
30
30
```json
31
31
{
32
32
"require": {
33
-
"andrey-helldar/laravel-actions": "^1.5"
33
+
"andrey-helldar/laravel-actions": "^1.6"
34
34
}
35
35
}
36
36
```
@@ -117,6 +117,46 @@ If the value is `$once = false`, the `up` method will be called every time the `
117
117
In this case, information about it will not be written to the `migration_actions` table and, therefore, the `down` method will not be called when the rollback
118
118
command is called.
119
119
120
+
#### Execution in a specific environment
121
+
122
+
In some cases, it becomes necessary to execute an action in a specific environment. For example `production`.
123
+
124
+
For this you can use the `$environment` parameter:
125
+
126
+
```php
127
+
use Helldar\LaravelActions\Support\Actionable;
128
+
129
+
class Reindex extends Actionable
130
+
{
131
+
/** @var string|array|null */
132
+
protected $environment = 'production';
133
+
134
+
public function up(): void
135
+
{
136
+
// your code
137
+
}
138
+
}
139
+
```
140
+
141
+
You can also specify multiple environment names:
142
+
143
+
```php
144
+
use Helldar\LaravelActions\Support\Actionable;
145
+
146
+
class Reindex extends Actionable
147
+
{
148
+
/** @var string|array|null */
149
+
protected $environment = ['testing', 'staging'];
150
+
151
+
public function up(): void
152
+
{
153
+
// your code
154
+
}
155
+
}
156
+
```
157
+
158
+
By default, the action will run in all environments. The same will happen if you specify `null` or `[]` as the value.
159
+
120
160
#### Database Transactions
121
161
122
162
In some cases, it becomes necessary to undo previously performed actions in the database. For example, when code execution throws an error. To do this, the code
@@ -201,7 +241,11 @@ This package is licensed under the [MIT License](LICENSE).
201
241
202
242
Available as part of the Tidelift Subscription.
203
243
204
-
The maintainers of `andrey-helldar/laravel-actions` and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source packages you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact packages you use. [Learn more](https://tidelift.com/subscription/pkg/packagist-andrey-helldar-laravel-actions?utm_source=packagist-andrey-helldar-laravel-actions&utm_medium=referral&utm_campaign=enterprise&utm_term=repo).
244
+
The maintainers of `andrey-helldar/laravel-actions` and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for
245
+
the open source packages you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact packages
0 commit comments