Better solution for goups without a prefix
This commit is contained in:
parent
74bd080709
commit
41bef94716
@ -73,7 +73,7 @@ abstract class Route
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static function group(string $prefix = '', ?callable $callback = null)
|
static function group(string $prefix, callable $callback)
|
||||||
{
|
{
|
||||||
if (!str_starts_with(
|
if (!str_starts_with(
|
||||||
$_SERVER['REQUEST_URI'],
|
$_SERVER['REQUEST_URI'],
|
||||||
|
@ -51,7 +51,7 @@ App::group('/test', function() {
|
|||||||
fn() => print('Testing 123'));
|
fn() => print('Testing 123'));
|
||||||
|
|
||||||
// you may also define a group without a prefix
|
// you may also define a group without a prefix
|
||||||
App::group(callback: function() {
|
App::group('', function() {
|
||||||
App::get('/test',
|
App::get('/test',
|
||||||
fn() => print('Testing 456'));
|
fn() => print('Testing 456'));
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user