Skip to content

Commit 33ba404

Browse files
committed
Fix(web): Fixed import of AuthorizationMiddleware and added middleware with example routes
1 parent a70ac9a commit 33ba404

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

routes/web.php

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
use LionRequest\Response;
55
use Carbon\Carbon;
66

7-
use App\Http\Middleware\JWT\AuthorizationControlMiddleware;
7+
use App\Http\Middleware\JWT\AuthorizationMiddleware;
88

99
/**
1010
* ------------------------------------------------------------------------------
@@ -14,19 +14,24 @@
1414
**/
1515

1616
Route::newMiddleware([
17-
['jwt-authorize', AuthorizationControlMiddleware::class, 'authorize']
17+
['auth', AuthorizationMiddleware::class, 'authorize'],
18+
['no-auth', AuthorizationMiddleware::class, 'notAuthorize']
1819
]);
1920

2021
Route::get('/', function() {
2122
return Response::success('Welcome to index! ' . Carbon::now());
2223
});
2324

2425
Route::prefix('auth', function() {
25-
Route::get('signin', function() {
26+
Route::post('signin', function() {
2627
return Response::success('signin...');
27-
});
28+
}, ['no-auth']);
2829

29-
Route::get('signout', function() {
30+
Route::post('signout', function() {
3031
return Response::success('signout...');
31-
});
32+
}, ['no-auth']);
33+
34+
Route::get('logout', function() {
35+
return Response::success('logout...');
36+
}, ['auth']);
3237
});

0 commit comments

Comments
 (0)