Skip to content

Commit 51aac74

Browse files
author
Andrey Helldar
authored
Update README.md
1 parent 17da27a commit 51aac74

File tree

1 file changed

+65
-4
lines changed

1 file changed

+65
-4
lines changed

README.md

Lines changed: 65 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,6 @@ To run all of your outstanding actions, execute the `migrate:actions` Artisan co
8787
php artisan migrate:actions
8888
```
8989

90-
> You can also override the `success` and `failed` methods, which are called on success or failure processing.
91-
9290
#### Forcing Actions To Run In Production
9391

9492
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
252250
php artisan migrate:actions:reset
253251
```
254252

255-
> You can also override the `success` and `failed` methods, which are called on success or failure processing.
256-
257253
### Roll Back & Action Using A Single Command
258254

259255
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
278274
php artisan migrate:actions:status
279275
```
280276

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+
281342
## License
282343

283344
This package is licensed under the [MIT License](LICENSE).

0 commit comments

Comments
 (0)