<?php use Ampersand\Route; Route::get('/', function () { echo "Hello world!"; });
<?php use Ampersand\Route; Route::get('/', function () { $this->render('index'); }); Route::get('/hello', function () { echo "Hello!"; }); Route::get('/hello/:name', function ($name) { echo "Hello {$name}!"; });
function test_group_of_routes_with_two_middlewares() { Route::group('admin', 'mid1', 'mid2', function () { Route::get('/dashboard', $this->getCallback()); }); $target = Route::getRoutes()[0]; $this->assertCount(2, $target['middlewares']); $this->assertEquals($target['middlewares'][0], 'mid1'); $this->assertEquals($target['middlewares'][1], 'mid2'); }