Skip to content

Commit

Permalink
Docs: Updated README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Sleon4 committed Jun 17, 2022
1 parent 520ca06 commit f77f85a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,17 @@ class HomeMiddleware extends Middleware {
}
```

to add a middleware you must open the middleware file located in `routes/middleware.php`, where there are default middleware for the use of JWT.
```php
use App\Http\Middleware\JWT\AuthorizationMiddleware;

LionRoute\Route::newMiddleware([
['jwt-exist', AuthorizationMiddleware::class, 'exist'],
['jwt-authorize', AuthorizationMiddleware::class, 'authorize'],
['jwt-not-authorize', AuthorizationMiddleware::class, 'notAuthorize']
]);
```

### 2. CONTROLLERS
Controllers are easy to implement. They must have the parent class imported into `Controller`, which initializes different functions and objects at the Controller level. <br>
The rule for Controllers is simple, in the constructor they must be initialized with the `$this->init()` function. <br>
Expand Down
3 changes: 1 addition & 2 deletions routes/middleware.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<?php

use LionRoute\Route;
use App\Http\Middleware\JWT\AuthorizationMiddleware;

Route::newMiddleware([
LionRoute\Route::newMiddleware([
['jwt-exist', AuthorizationMiddleware::class, 'exist'],
['jwt-authorize', AuthorizationMiddleware::class, 'authorize'],
['jwt-not-authorize', AuthorizationMiddleware::class, 'notAuthorize']
Expand Down
5 changes: 1 addition & 4 deletions routes/web.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
<?php

use LionRoute\Route;
use LionRequest\Response;
use Carbon\Carbon;

use App\Http\Controllers\Users\UsersController;

/**
Expand All @@ -14,7 +11,7 @@
**/

Route::any('/', function() {
return Response::success('Welcome to index! ' . Carbon::now());
return LionRequest\Response::success('Welcome to index! ' . Carbon\Carbon::now());
});

Route::prefix('users', function() {
Expand Down

0 comments on commit f77f85a

Please sign in to comment.