This repository was archived by the owner on Mar 24, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +25
-14
lines changed Expand file tree Collapse file tree 2 files changed +25
-14
lines changed Original file line number Diff line number Diff line change @@ -278,20 +278,6 @@ public function terminate(Request $request, $response)
278
278
protected function terminateLaravel (Request $ request , $ response )
279
279
{
280
280
$ this ->getKernel ()->terminate ($ request , $ response );
281
-
282
- // clean laravel session
283
- if ($ request ->hasSession ()) {
284
- $ session = $ request ->getSession ();
285
- $ session ->flush ();
286
- }
287
-
288
- // clean laravel cookie queue
289
- if (isset ($ this ->application ['cookie ' ])) {
290
- $ cookies = $ this ->application ['cookie ' ];
291
- foreach ($ cookies ->getQueuedCookies () as $ name => $ cookie ) {
292
- $ cookies ->unqueue ($ name );
293
- }
294
- }
295
281
}
296
282
297
283
/**
Original file line number Diff line number Diff line change @@ -107,6 +107,8 @@ public function getApplication()
107
107
protected function resetLaravelApp ($ application )
108
108
{
109
109
$ this ->resetConfigInstance ($ application );
110
+ $ this ->resetSession ($ application );
111
+ $ this ->resetCookie ($ application );
110
112
$ this ->clearInstances ($ application );
111
113
$ this ->rebindRouterContainer ($ application );
112
114
$ this ->rebindViewContainer ($ application );
@@ -131,6 +133,29 @@ protected function resetConfigInstance($application)
131
133
$ application ->instance ('config ' , clone $ this ->config );
132
134
}
133
135
136
+ /**
137
+ * Reset laravel's session data.
138
+ */
139
+ protected function resetSession ($ application )
140
+ {
141
+ if (isset ($ application ['session ' ])) {
142
+ $ session = $ application ->make ('session ' );
143
+ $ session ->flush ();
144
+ }
145
+ }
146
+
147
+ /**
148
+ * Reset laravel's cookie.
149
+ */
150
+ protected function resetCookie ($ application )
151
+ {
152
+ if (isset ($ application ['cookie ' ])) {
153
+ foreach ($ application ->make ('cookie ' )->getQueuedCookies () as $ key => $ value ) {
154
+ $ cookies ->unqueue ($ key );
155
+ }
156
+ }
157
+ }
158
+
134
159
/**
135
160
* Rebind laravel's container in router.
136
161
*/
You can’t perform that action at this time.
0 commit comments