-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from TheDragonCode/2.x
Method to be called on runtime error
- Loading branch information
Showing
7 changed files
with
232 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
use DragonCode\LaravelActions\Support\Actionable; | ||
use Illuminate\Database\Query\Builder; | ||
use Illuminate\Support\Facades\DB; | ||
use Ramsey\Uuid\Uuid; | ||
|
||
class RunFailed extends Actionable | ||
{ | ||
public function up(): void | ||
{ | ||
} | ||
|
||
public function down(): void | ||
{ | ||
} | ||
|
||
public function failed(): void | ||
{ | ||
$this->table()->insert([ | ||
'value' => Uuid::uuid4(), | ||
]); | ||
} | ||
|
||
protected function table(): Builder | ||
{ | ||
return DB::table('success'); | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
tests/fixtures/actions_failed/2021_12_23_184029_run_failed_failure.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
use DragonCode\LaravelActions\Support\Actionable; | ||
use Illuminate\Database\Query\Builder; | ||
use Illuminate\Support\Facades\DB; | ||
use Ramsey\Uuid\Uuid; | ||
|
||
class RunFailedFailure extends Actionable | ||
{ | ||
public function up(): void | ||
{ | ||
throw new Exception('Custom exception'); | ||
} | ||
|
||
public function down(): void | ||
{ | ||
throw new Exception('Custom exception'); | ||
} | ||
|
||
public function failed(): void | ||
{ | ||
$this->table()->insert([ | ||
'value' => Uuid::uuid4(), | ||
]); | ||
} | ||
|
||
protected function table(): Builder | ||
{ | ||
return DB::table('failed'); | ||
} | ||
} |
Oops, something went wrong.