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
@@ -195,7 +195,7 @@ class Reindex extends Actionable
195
195
{
196
196
// your code
197
197
}
198
-
}
198
+
};
199
199
```
200
200
201
201
By default, no actions will be excluded. The same happens if you specify `null` or `[]` value.
@@ -211,7 +211,7 @@ will reduce the time it takes to create the action.
211
211
```php
212
212
use DragonCode\LaravelActions\Support\Actionable;
213
213
214
-
class AddSomeData extends Actionable
214
+
return new class extends Actionable
215
215
{
216
216
protected $transactions = true;
217
217
@@ -227,7 +227,7 @@ class AddSomeData extends Actionable
227
227
228
228
$post->tags()->sync($ids);
229
229
}
230
-
}
230
+
};
231
231
```
232
232
233
233
### Rolling Back Actions
@@ -284,7 +284,7 @@ You can also override the `success` and `failed` methods, which are called on su
284
284
use DragonCode\LaravelActions\Support\Actionable;
285
285
use Illuminate\Support\Facade\Log;
286
286
287
-
class AddSomeData extends Actionable
287
+
return new class extends Actionable
288
288
{
289
289
public function up(): void
290
290
{
@@ -305,7 +305,7 @@ class AddSomeData extends Actionable
305
305
{
306
306
Log::info('failed');
307
307
}
308
-
}
308
+
};
309
309
```
310
310
311
311
Call the `php artisan migrate:actions` command.
@@ -319,7 +319,7 @@ use DragonCode\LaravelActions\Support\Actionable;
319
319
use Exeption;
320
320
use Illuminate\Support\Facade\Log;
321
321
322
-
class AddSomeData extends Actionable
322
+
return new class extends Actionable
323
323
{
324
324
public function up(): void
325
325
{
@@ -340,7 +340,7 @@ class AddSomeData extends Actionable
340
340
{
341
341
Log::info('failed');
342
342
}
343
-
}
343
+
};
344
344
```
345
345
346
346
Call the `php artisan migrate:actions` command.
@@ -352,25 +352,34 @@ The log file will contain two `failed` entries.
352
352
Quite often, when working with actions, it becomes necessary to run one or another console command, and each time you have to write the following code:
353
353
354
354
```php
355
+
use DragonCode\LaravelActions\Support\Actionable;
355
356
use Illuminate\Support\Facades\Artisan;
356
357
357
-
public function up()
358
+
return new class extends Actionable
358
359
{
359
-
Artisan::call('command-name', [
360
-
// parameters
361
-
]);
362
-
}
360
+
public function up()
361
+
{
362
+
Artisan::call('command-name', [
363
+
// parameters
364
+
]);
365
+
}
366
+
};
363
367
```
364
368
365
369
Since version [`2.3`](https://github.com/TheDragonCode/laravel-migration-actions/releases/tag/v2.3.0) we have added a method call. Now calling commands has become much easier:
0 commit comments