This repository was archived by the owner on Mar 24, 2025. It is now read-only.
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 4
4
5
5
use SwooleTW \Http \Helpers \FW ;
6
6
use Illuminate \Queue \QueueManager ;
7
- use Illuminate \Contracts \Http \Kernel ;
8
7
use Swoole \Http \Server as HttpServer ;
9
8
use Illuminate \Support \ServiceProvider ;
10
- use SwooleTW \Http \Middleware \AccessLog ;
11
9
use SwooleTW \Http \Server \Facades \Server ;
12
10
use Illuminate \Database \DatabaseManager ;
13
11
use SwooleTW \Http \Coroutine \MySqlConnection ;
@@ -62,11 +60,18 @@ public function register()
62
60
abstract protected function registerManager ();
63
61
64
62
/**
65
- * Boot routes.
63
+ * Boot websocket routes.
66
64
*
67
65
* @return void
68
66
*/
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 ();
70
75
71
76
/**
72
77
* Boot the service provider.
@@ -88,7 +93,7 @@ public function boot()
88
93
}
89
94
90
95
if ($ config ->get ('swoole_http.server.access_log ' )) {
91
- $ this ->app -> make (Kernel::class)-> pushMiddleware (AccessLog::class );
96
+ $ this ->pushAccessLogMiddleware ( );
92
97
}
93
98
}
94
99
Original file line number Diff line number Diff line change 3
3
namespace SwooleTW \Http ;
4
4
5
5
use SwooleTW \Http \Server \Manager ;
6
+ use Illuminate \Contracts \Http \Kernel ;
7
+ use SwooleTW \Http \Middleware \AccessLog ;
6
8
7
9
/**
8
10
* @codeCoverageIgnore
@@ -24,12 +26,22 @@ protected function registerManager()
24
26
}
25
27
26
28
/**
27
- * Boot routes.
29
+ * Boot websocket routes.
28
30
*
29
31
* @return void
30
32
*/
31
- protected function bootRoutes ()
33
+ protected function bootWebsocketRoutes ()
32
34
{
33
35
require __DIR__ . '/../routes/laravel_routes.php ' ;
34
36
}
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
+ }
35
47
}
Original file line number Diff line number Diff line change 3
3
namespace SwooleTW \Http ;
4
4
5
5
use SwooleTW \Http \Server \Manager ;
6
+ use SwooleTW \Http \Middleware \AccessLog ;
6
7
7
8
/**
8
9
* @codeCoverageIgnore
@@ -24,14 +25,15 @@ protected function registerManager()
24
25
}
25
26
26
27
/**
27
- * Boot routes.
28
+ * Boot websocket routes.
28
29
*
29
30
* @return void
30
31
*/
31
- protected function bootRoutes ()
32
+ protected function bootWebsocketRoutes ()
32
33
{
33
34
$ app = $ this ->app ;
34
35
36
+ // router only exists after lumen 5.5
35
37
if (property_exists ($ app , 'router ' )) {
36
38
$ app ->router ->group (['namespace ' => 'SwooleTW\Http\Controllers ' ], function ($ app ) {
37
39
require __DIR__ . '/../routes/lumen_routes.php ' ;
@@ -42,4 +44,14 @@ protected function bootRoutes()
42
44
});
43
45
}
44
46
}
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
+ }
45
57
}
You can’t perform that action at this time.
0 commit comments