-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add retry button to provision-request-show view
- Loading branch information
Showing
4 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
app/Http/Controllers/Web/ProvisionRequestRetryController.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,49 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Http\Controllers\Web; | ||
|
||
use App\Http\Controllers\Controller; | ||
use App\Http\Controllers\Traits\InteractsWithRegistry; | ||
use App\Http\Controllers\Traits\TransformsArrayDot; | ||
use App\Models\ProviderConfiguration; | ||
use App\Models\ProvisionRequest; | ||
use App\Services\ProvisionRequestService; | ||
use Illuminate\Http\Request; | ||
|
||
class ProvisionRequestRetryController extends Controller | ||
{ | ||
use InteractsWithRegistry; | ||
use TransformsArrayDot; | ||
|
||
public function __invoke(Request $request, ProvisionRequest $provision_request) | ||
{ | ||
$configuration = $provision_request->configuration; | ||
|
||
if (!isset($configuration)) { | ||
return redirect(route('provision-request-new', ['provision_request_id' => $provision_request->id])) | ||
->withErrors([ | ||
'configuration_id' => 'Configuration not found', | ||
]); | ||
} | ||
|
||
$function = $provision_request->getFunction(); | ||
|
||
if (!isset($function)) { | ||
return redirect(route('provision-request-new', ['provision_request_id' => $provision_request->id])) | ||
->withErrors([ | ||
'function_name' => sprintf('Function %s not found', $provision_request->function_name), | ||
]); | ||
} | ||
|
||
$parameters = $provision_request->parameter_data; | ||
|
||
$service = new ProvisionRequestService(); | ||
$retriedRequest = $service->create($function, $configuration, $parameters); | ||
|
||
return redirect( | ||
route('provision-request-show', ['provision_request' => $retriedRequest]) | ||
); | ||
} | ||
} |
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