File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
src/Illuminate/Foundation/Support/Providers Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,13 @@ class RouteServiceProvider extends ServiceProvider
3636 */
3737 protected static $ alwaysLoadRoutesUsing ;
3838
39+ /**
40+ * The callback that should be used to load the application's cached routes.
41+ *
42+ * @var \Closure|null
43+ */
44+ protected static $ alwaysLoadCachedRoutesUsing ;
45+
3946 /**
4047 * Register any application services.
4148 *
@@ -93,6 +100,17 @@ public static function loadRoutesUsing(?Closure $routesCallback)
93100 self ::$ alwaysLoadRoutesUsing = $ routesCallback ;
94101 }
95102
103+ /**
104+ * Register the callback that will be used to load the application's cached routes.
105+ *
106+ * @param \Closure|null $routesCallback
107+ * @return void
108+ */
109+ public static function loadCachedRoutesUsing (?Closure $ routesCallback )
110+ {
111+ self ::$ alwaysLoadCachedRoutesUsing = $ routesCallback ;
112+ }
113+
96114 /**
97115 * Set the root controller namespace for the application.
98116 *
@@ -122,6 +140,12 @@ protected function routesAreCached()
122140 */
123141 protected function loadCachedRoutes ()
124142 {
143+ if (! is_null (self ::$ alwaysLoadCachedRoutesUsing )) {
144+ $ this ->app ->call (self ::$ alwaysLoadCachedRoutesUsing );
145+
146+ return ;
147+ }
148+
125149 $ this ->app ->booted (function () {
126150 require $ this ->app ->getCachedRoutesPath ();
127151 });
You can’t perform that action at this time.
0 commit comments