-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds controller logic and route defintion for generating targets base…
…d on an existing workflown namespace
- Loading branch information
Showing
2 changed files
with
42 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
namespace CraigPaul\Blitz\Http\Controllers; | ||
|
||
use Illuminate\Contracts\Foundation\Application; | ||
use Illuminate\Contracts\Routing\ResponseFactory; | ||
use Illuminate\Http\JsonResponse; | ||
use Illuminate\Http\Request; | ||
|
||
class TargetController | ||
{ | ||
/** | ||
* Create a new controller instance. | ||
* | ||
* @param \Illuminate\Contracts\Foundation\Application $app | ||
* @param \Illuminate\Contracts\Routing\ResponseFactory $response | ||
* | ||
* @return void | ||
*/ | ||
public function __construct( | ||
protected Application $app, | ||
protected ResponseFactory $response, | ||
) { | ||
} | ||
|
||
/** | ||
* Store a newly created resource in storage. | ||
* | ||
* @param \Illuminate\Http\Request $request | ||
* | ||
* @return \Illuminate\Http\JsonResponse | ||
*/ | ||
public function store(Request $request): JsonResponse | ||
{ | ||
$instance = $this->app->make($request->post('namespace')); | ||
|
||
$instance->setUp(); | ||
|
||
return $this->response->json($instance->getTargets()); | ||
} | ||
} |