I am kinda new with Slim framework and now I have this problem with named routing... My code for the first route goes like this
$app->get('/admin/home', function() use ($app){
if(!isset($_SESSION)){
$app->render('admin/login.php', [
'message' => 'Restricted access!'
]);
}else{
session_start();
$app->render('admin/home.php', [
'username' => $_SESSION['username']
]);
}
})->name('/admin/home');
but then, when i call this route from another one like this
$app->post('/admin/login', function() use ($app, $conn) {
$app->urlFor('/admin/home');
})->name('/admin/login');
it throws an exception "Named route already exists with name: /admin/login"
i just don't get it... is it even possible to call one route from another one? As i have seen in Slim documentation it should be... Where am i going wrong? Thanks