|
6 | 6 | use Leaf\Auth; |
7 | 7 |
|
8 | 8 | /** |
9 | | - * This is the base controller for your Leaf API Project. |
| 9 | + * This is the base controller for your Leaf MVC Project. |
10 | 10 | * You can initialize packages or define methods here to use |
11 | 11 | * them across all your other controllers which extend this one. |
12 | 12 | */ |
13 | | -class Controller extends \Leaf\ApiController |
| 13 | +class Controller extends \Leaf\Controller |
14 | 14 | { |
15 | | - public function __construct() |
16 | | - { |
17 | | - parent::__construct(); |
| 15 | + public function __construct() |
| 16 | + { |
| 17 | + parent::__construct(); |
18 | 18 |
|
19 | | - // In this version, request isn't initialised for you. You can use |
20 | | - // requestData() or request() to get request data or initialise it yourself |
| 19 | + // In this version, request isn't initialised for you. You can use |
| 20 | + // requestData() or request() to get request data or initialise it yourself |
21 | 21 |
|
22 | | - // autoConnect uses the .env variables to quickly connect to db |
23 | | - Auth::autoConnect(); |
| 22 | + // autoConnect uses the .env variables to quickly connect to db |
| 23 | + Auth::autoConnect(); |
24 | 24 |
|
25 | | - // set default token expiry time |
26 | | - Auth::tokenLifetime(60 * 60 * 24 * 365); |
| 25 | + // You can configure auth to get additional customizations |
| 26 | + // This can be done here with the Auth::config method or |
| 27 | + // simply in the config/auth.php file |
| 28 | + Auth::config(AuthConfig()); |
27 | 29 |
|
28 | | - // You can configure auth to get additional customizations |
29 | | - // This can be done here with the Auth::config method or |
30 | | - // simply in the Config/auth.php file |
31 | | - Auth::config(AuthConfig()); |
| 30 | + // You can refer to https://leafphp.dev/modules/auth for auth docs |
32 | 31 |
|
33 | | - // You can refer to https://leafphp.netlify.app/#/leaf/v/2.5/core/auth for auth docs |
34 | | - } |
| 32 | + // To use session instead of JWT, open up config/auth.php and set |
| 33 | + // USE_SESSION to true |
| 34 | + } |
35 | 35 | } |
0 commit comments