99use Dropelikeit \LaravelJmsSerializer \Http \Responses \ResponseFactory ;
1010use Dropelikeit \LaravelJmsSerializer \Serializer \Factory ;
1111use Illuminate \Config \Repository ;
12+ use Illuminate \Support \Facades \Storage ;
1213use Illuminate \Support \ServiceProvider as BaseServiceProvider ;
1314use function sprintf ;
1415
@@ -30,7 +31,11 @@ public function register(): void
3031 /** @var Repository $configRepository */
3132 $ configRepository = $ this ->app ->get ('config ' );
3233
33- $ path = $ this ->app ->storagePath ();
34+ $ cacheDir = $ this ->app ->storagePath ('framework/cache/data ' );
35+ if (!Storage::exists ($ cacheDir )) {
36+ Storage::makeDirectory ($ cacheDir );
37+ }
38+
3439 $ shouldSerializeNull = (bool ) $ configRepository
3540 ->get ('laravel-jms-serializer.serialize_null ' , true );
3641 $ serializeType = $ configRepository
@@ -46,7 +51,7 @@ public function register(): void
4651
4752 $ config = Config::fromConfig ([
4853 'serialize_null ' => $ shouldSerializeNull ,
49- 'cache_dir ' => $ path ,
54+ 'cache_dir ' => $ cacheDir ,
5055 'serialize_type ' => $ serializeType ,
5156 'debug ' => $ debug ,
5257 'add_default_handlers ' => $ addDefaultHandlers ,
@@ -81,7 +86,7 @@ public function boot(): void
8186 *
8287 * @return string
8388 */
84- protected function getConfigPath (): string
89+ private function getConfigPath (): string
8590 {
8691 return config_path ('laravel-jms-serializer.php ' );
8792 }
0 commit comments