Added routes and views for adding and listing benchmarks and components
This commit is contained in:
@ -10,6 +10,15 @@ use BitGoblin\Colossus\Models\Benchmark;
|
||||
|
||||
class BenchmarkController extends Controller {
|
||||
|
||||
public function getIndex(Request $request, Response $response): Response {
|
||||
// redirect the user back to the home page
|
||||
$routeContext = RouteContext::fromRequest($request);
|
||||
$routeParser = $routeContext->getRouteParser();
|
||||
return $response
|
||||
->withHeader('Location', $routeParser->urlFor('benchmark.list'))
|
||||
->withStatus(302);
|
||||
}
|
||||
|
||||
public function getList(Request $request, Response $response): Response {
|
||||
$benchmarks = Benchmark::orderByDesc('updated_at')->get();
|
||||
|
||||
|
@ -10,6 +10,15 @@ use BitGoblin\Colossus\Models\Component;
|
||||
|
||||
class ComponentController extends Controller {
|
||||
|
||||
public function getIndex(Request $request, Response $response): Response {
|
||||
// redirect the user back to the home page
|
||||
$routeContext = RouteContext::fromRequest($request);
|
||||
$routeParser = $routeContext->getRouteParser();
|
||||
return $response
|
||||
->withHeader('Location', $routeParser->urlFor('component.list'))
|
||||
->withStatus(302);
|
||||
}
|
||||
|
||||
public function getList(Request $request, Response $response): Response {
|
||||
$components = Component::orderByDesc('updated_at')->get();
|
||||
|
||||
@ -38,7 +47,7 @@ class ComponentController extends Controller {
|
||||
|
||||
$component = new Component;
|
||||
$component->name = $params['component_name'];
|
||||
$component->type = $params['component_description'];
|
||||
$component->type = $params['component_type'];
|
||||
|
||||
$component->save();
|
||||
|
||||
|
Reference in New Issue
Block a user