Skip to content
This repository was archived by the owner on Jun 8, 2022. It is now read-only.

Commit fb9b6af

Browse files
committed
Group routes as a better example
1 parent 2a02809 commit fb9b6af

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

inc/routes/web.php

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
<?php
22

33
use App\Controllers\HomeController;
4+
use Slim\Routing\RouteCollectorProxy;
45

5-
$this->slim->get('/', HomeController::class . ':index');
6-
$this->slim->post('/', HomeController::class . ':update');
6+
/**
7+
* Home
8+
*/
9+
$this->slim->group('', function (RouteCollectorProxy $group) {
10+
$group->get('/', HomeController::class . ':index')->setName('home');
11+
$group->post('/', HomeController::class . ':update');
12+
});

0 commit comments

Comments
 (0)