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
+65-4Lines changed: 65 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -87,8 +87,6 @@ To run all of your outstanding actions, execute the `migrate:actions` Artisan co
87
87
php artisan migrate:actions
88
88
```
89
89
90
-
> You can also override the `success` and `failed` methods, which are called on success or failure processing.
91
-
92
90
#### Forcing Actions To Run In Production
93
91
94
92
Some action operations are destructive, which means they may cause you to lose data. In order to protect you from running these commands against your production database, you will
@@ -252,8 +250,6 @@ The `migrate:actions:reset` command will roll back all of your application's mig
252
250
php artisan migrate:actions:reset
253
251
```
254
252
255
-
> You can also override the `success` and `failed` methods, which are called on success or failure processing.
256
-
257
253
### Roll Back & Action Using A Single Command
258
254
259
255
The `migrate:actions:refresh` command will roll back all of your migrations and then execute the `migrate:actions` command. This command effectively re-creates your entire
@@ -278,6 +274,71 @@ The `migrate:actions:status` command displays the execution status of actions. I
278
274
php artisan migrate:actions:status
279
275
```
280
276
277
+
### Execution status
278
+
279
+
You can also override the `success` and `failed` methods, which are called on success or failure processing.
280
+
281
+
#### If Success
282
+
283
+
```php
284
+
use DragonCode\LaravelActions\Support\Actionable;
285
+
use Illuminate\Support\Facade\Log;
286
+
287
+
class AddSomeData extends Actionable
288
+
{
289
+
public function up(): void
290
+
{
291
+
//
292
+
}
293
+
294
+
public function down(): void
295
+
{
296
+
//
297
+
}
298
+
299
+
public function success(): void
300
+
{
301
+
Log::info('success');
302
+
}
303
+
}
304
+
```
305
+
306
+
Call the `php artisan migrate:actions` command.
307
+
308
+
The log file will contain two `success` entries.
309
+
310
+
#### If Failed
311
+
312
+
```php
313
+
use DragonCode\LaravelActions\Support\Actionable;
314
+
use Exeption;
315
+
use Illuminate\Support\Facade\Log;
316
+
317
+
class AddSomeData extends Actionable
318
+
{
319
+
public function up(): void
320
+
{
321
+
throw new Exeption();
322
+
}
323
+
324
+
public function down(): void
325
+
{
326
+
throw new Exeption();
327
+
}
328
+
329
+
public function success(): void
330
+
{
331
+
Log::info('failed');
332
+
}
333
+
}
334
+
```
335
+
336
+
Call the `php artisan migrate:actions` command.
337
+
338
+
The log file will contain two `failed` entries.
339
+
340
+
341
+
281
342
## License
282
343
283
344
This package is licensed under the [MIT License](LICENSE).
0 commit comments