|
@@ -3,27 +3,27 @@ |
|
|
block discarded – undo |
|
3
|
3
|
use HnrAzevedo\Router\Router; |
|
4
|
4
|
|
|
5
|
5
|
/* Returning parameters passed via URL in anonymous functions */ |
|
6
|
|
-Router::match('GET|POST|AJAX','/{parameter}/{otherparameter}', function($parameter, $otherparameter){ |
|
|
6
|
+Router::match('GET|POST|AJAX', '/{parameter}/{otherparameter}', function($parameter, $otherparameter) { |
|
7
|
7
|
//echo "Parameter 1:{$parameter}, Parameter 2:{$otherparameter}."; |
|
8
|
8
|
}); |
|
9
|
9
|
|
|
10
|
10
|
/* Passing controller and/or method via parameter in URL */ |
|
11
|
|
-Router::get('/{controller}/{method}','{controller}:{method}'); |
|
|
11
|
+Router::get('/{controller}/{method}', '{controller}:{method}'); |
|
12
|
12
|
//Router::get('/{controller}/{method}','{controller}:method'); |
|
13
|
13
|
|
|
14
|
14
|
/* Passing value via parameter */ |
|
15
|
|
-Router::get('/my-account/{teste}','Controller\\User:my_account'); |
|
|
15
|
+Router::get('/my-account/{teste}', 'Controller\\User:my_account'); |
|
16
|
16
|
|
|
17
|
17
|
/* Middleware example */ |
|
18
|
18
|
//Router::get('/my-account','Controller\\User:my_account')->middleware(['\Example\Middleware\Auth::class','Lasted']); |
|
19
|
19
|
|
|
20
|
20
|
|
|
21
|
21
|
|
|
22
|
|
-Router::get('/my-account1',function(){ |
|
|
22
|
+Router::get('/my-account1', function() { |
|
23
|
23
|
echo 'is Ok!'; |
|
24
|
|
-})->middleware(['\Example\Middleware\Auth::class','Lasted']); |
|
|
24
|
+})->middleware(['\Example\Middleware\Auth::class', 'Lasted']); |
|
25
|
25
|
|
|
26
|
26
|
/* Accessed by all protocols */ |
|
27
|
|
-Router::any('/',function(){ |
|
|
27
|
+Router::any('/', function() { |
|
28
|
28
|
// |
|
29
|
29
|
})->name('index'); |