Skip to content

Commit 2737906

Browse files
committed
Implement possibility to get route params from URL
1 parent 4610df1 commit 2737906

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

controllers/SiteController.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ public function home()
3838

3939
public function login(Request $request)
4040
{
41+
echo '<pre>';
42+
var_dump($request->getBody(), $request->getRouteParam('id'));
43+
echo '</pre>';
4144
$loginForm = new LoginForm();
4245
if ($request->getMethod() === 'post') {
4346
$loginForm->loadData($request->getBody());

public/index.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
$app->router->get('/contact', [SiteController::class, 'contact']);
3939
$app->router->get('/about', [AboutController::class, 'index']);
4040
$app->router->get('/profile', [SiteController::class, 'profile']);
41+
$app->router->get('/profile/{id:\d+}/{username}', [SiteController::class, 'login']);
4142
// /profile/{id}
4243
// /profile/13
4344
// \/profile\/\w+

0 commit comments

Comments
 (0)