File tree Expand file tree Collapse file tree 3 files changed +38
-9
lines changed Expand file tree Collapse file tree 3 files changed +38
-9
lines changed Original file line number Diff line number Diff line change 44
55use SwooleTW \Http \Helpers \FW ;
66use Illuminate \Queue \QueueManager ;
7- use Illuminate \Contracts \Http \Kernel ;
87use Swoole \Http \Server as HttpServer ;
98use Illuminate \Support \ServiceProvider ;
10- use SwooleTW \Http \Middleware \AccessLog ;
119use SwooleTW \Http \Server \Facades \Server ;
1210use Illuminate \Database \DatabaseManager ;
1311use SwooleTW \Http \Coroutine \MySqlConnection ;
@@ -62,11 +60,18 @@ public function register()
6260 abstract protected function registerManager ();
6361
6462 /**
65- * Boot routes.
63+ * Boot websocket routes.
6664 *
6765 * @return void
6866 */
69- abstract protected function bootRoutes ();
67+ abstract protected function bootWebsocketRoutes ();
68+
69+ /**
70+ * Register access log middleware to container.
71+ *
72+ * @return void
73+ */
74+ abstract protected function pushAccessLogMiddleware ();
7075
7176 /**
7277 * Boot the service provider.
@@ -88,7 +93,7 @@ public function boot()
8893 }
8994
9095 if ($ config ->get ('swoole_http.server.access_log ' )) {
91- $ this ->app -> make (Kernel::class)-> pushMiddleware (AccessLog::class );
96+ $ this ->pushAccessLogMiddleware ( );
9297 }
9398 }
9499
Original file line number Diff line number Diff line change 33namespace SwooleTW \Http ;
44
55use SwooleTW \Http \Server \Manager ;
6+ use Illuminate \Contracts \Http \Kernel ;
7+ use SwooleTW \Http \Middleware \AccessLog ;
68
79/**
810 * @codeCoverageIgnore
@@ -24,12 +26,22 @@ protected function registerManager()
2426 }
2527
2628 /**
27- * Boot routes.
29+ * Boot websocket routes.
2830 *
2931 * @return void
3032 */
31- protected function bootRoutes ()
33+ protected function bootWebsocketRoutes ()
3234 {
3335 require __DIR__ . '/../routes/laravel_routes.php ' ;
3436 }
37+
38+ /**
39+ * Register access log middleware to container.
40+ *
41+ * @return void
42+ */
43+ protected function pushAccessLogMiddleware ()
44+ {
45+ $ this ->app ->make (Kernel::class)->pushMiddleware (AccessLog::class);
46+ }
3547}
Original file line number Diff line number Diff line change 33namespace SwooleTW \Http ;
44
55use SwooleTW \Http \Server \Manager ;
6+ use SwooleTW \Http \Middleware \AccessLog ;
67
78/**
89 * @codeCoverageIgnore
@@ -24,14 +25,15 @@ protected function registerManager()
2425 }
2526
2627 /**
27- * Boot routes.
28+ * Boot websocket routes.
2829 *
2930 * @return void
3031 */
31- protected function bootRoutes ()
32+ protected function bootWebsocketRoutes ()
3233 {
3334 $ app = $ this ->app ;
3435
36+ // router only exists after lumen 5.5
3537 if (property_exists ($ app , 'router ' )) {
3638 $ app ->router ->group (['namespace ' => 'SwooleTW\Http\Controllers ' ], function ($ app ) {
3739 require __DIR__ . '/../routes/lumen_routes.php ' ;
@@ -42,4 +44,14 @@ protected function bootRoutes()
4244 });
4345 }
4446 }
47+
48+ /**
49+ * Register access log middleware to container.
50+ *
51+ * @return void
52+ */
53+ protected function pushAccessLogMiddleware ()
54+ {
55+ $ this ->app ->middleware (AccessLog::class);
56+ }
4557}
You can’t perform that action at this time.
0 commit comments