File tree Expand file tree Collapse file tree 4 files changed +8
-11
lines changed Expand file tree Collapse file tree 4 files changed +8
-11
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,6 @@ DB_COLLATION=utf8mb4_unicode_ci
1111DB_PREFIX =
1212
1313REDIS_HOST = localhost
14- REDIS_AUTH =
14+ REDIS_AUTH = (null)
1515REDIS_PORT = 6379
1616REDIS_DB = 0
Original file line number Diff line number Diff line change 1212
1313namespace App \Controller ;
1414
15+ use Hyperf \Di \Annotation \Inject ;
1516use Hyperf \HttpServer \Contract \RequestInterface ;
1617use Hyperf \HttpServer \Contract \ResponseInterface ;
1718use Psr \Container \ContainerInterface ;
1819
19- abstract class Controller
20+ abstract class AbstractController
2021{
2122 /**
23+ * @Inject
2224 * @var ContainerInterface
2325 */
2426 protected $ container ;
2527
2628 /**
29+ * @Inject
2730 * @var RequestInterface
2831 */
2932 protected $ request ;
3033
3134 /**
35+ * @Inject
3236 * @var ResponseInterface
3337 */
3438 protected $ response ;
35-
36- public function __construct (ContainerInterface $ container )
37- {
38- $ this ->container = $ container ;
39- $ this ->request = $ container ->get (RequestInterface::class);
40- $ this ->response = $ container ->get (ResponseInterface::class);
41- }
4239}
Original file line number Diff line number Diff line change 1212
1313namespace App \Controller ;
1414
15- class IndexController extends Controller
15+ class IndexController extends AbstractController
1616{
1717 public function index ()
1818 {
Original file line number Diff line number Diff line change 1313return [
1414 'default ' => [
1515 'host ' => env ('REDIS_HOST ' , 'localhost ' ),
16- 'auth ' => env ('REDIS_AUTH ' , '' ),
16+ 'auth ' => env ('REDIS_AUTH ' , null ),
1717 'port ' => (int ) env ('REDIS_PORT ' , 6379 ),
1818 'db ' => (int ) env ('REDIS_DB ' , 0 ),
1919 'pool ' => [
You can’t perform that action at this time.
0 commit comments