44use Clockwork \DataSource \LumenDataSource ;
55use Clockwork \DataSource \PhpDataSource ;
66use Clockwork \Request \Log ;
7+ use Clockwork \Request \Request ;
78use Clockwork \Support \Laravel \ClockworkServiceProvider as LaravelServiceProvider ;
89
910use Illuminate \Support \Facades \Facade ;
@@ -26,6 +27,7 @@ public function register()
2627 $ clockwork = (new Clockwork )
2728 ->setAuthenticator ($ app ['clockwork.authenticator ' ])
2829 ->setLog ($ app ['clockwork.log ' ])
30+ ->setRequest ($ app ['clockwork.request ' ])
2931 ->setStorage ($ app ['clockwork.storage ' ])
3032 ->addDataSource (new PhpDataSource ())
3133 ->addDataSource ($ app ['clockwork.lumen ' ]);
@@ -49,6 +51,10 @@ public function register()
4951 return new Log ;
5052 });
5153
54+ $ this ->app ->singleton ('clockwork.request ' , function ($ app ) {
55+ return new Request ;
56+ });
57+
5258 $ this ->app ->singleton ('clockwork.storage ' , function ($ app ) {
5359 return $ app ['clockwork.support ' ]->getStorage ();
5460 });
@@ -61,6 +67,7 @@ public function register()
6167 $ this ->registerDataSources ();
6268 $ this ->registerAliases ();
6369
70+ $ this ->app ->make ('clockwork.request ' ); // instantiate the request to have id and time available as early as possible
6471 $ this ->app ['clockwork.support ' ]->configureSerializer ();
6572
6673 if ($ this ->isRunningWithFacades () && ! class_exists ('Clockwork ' )) {
0 commit comments