diff --git a/src/MediaManagerServiceProvider.php b/src/MediaManagerServiceProvider.php index a1e11ba..01817c8 100644 --- a/src/MediaManagerServiceProvider.php +++ b/src/MediaManagerServiceProvider.php @@ -74,35 +74,36 @@ protected function socketRoute() */ protected function viewComp() { - $data = []; - - // base url + $data = []; $config = $this->app['config']->get('mediaManager'); - $url = $this->app['filesystem'] - ->disk($config['storage_disk']) - ->url('/'); - $data['base_url'] = preg_replace('/\/+$/', '/', $url); + if ($config) { + // base url + $url = $this->app['filesystem'] + ->disk($config['storage_disk']) + ->url('/'); + $data['base_url'] = preg_replace('/\/+$/', '/', $url); - // upload panel bg patterns - $pattern_path = public_path('assets/vendor/MediaManager/patterns'); + // upload panel bg patterns + $pattern_path = public_path('assets/vendor/MediaManager/patterns'); - if ($this->file->exists($pattern_path)) { - $patterns = collect( - $this->file->allFiles($pattern_path) - )->map(function ($item) { - $name = str_replace('\\', '/', $item->getPathName()); + if ($this->file->exists($pattern_path)) { + $patterns = collect( + $this->file->allFiles($pattern_path) + )->map(function ($item) { + $name = str_replace('\\', '/', $item->getPathName()); - return preg_replace('/.*\/patterns/', '/assets/vendor/MediaManager/patterns', $name); - }); + return preg_replace('/.*\/patterns/', '/assets/vendor/MediaManager/patterns', $name); + }); - $data['patterns'] = json_encode($patterns); - } + $data['patterns'] = json_encode($patterns); + } - // share - view()->composer('MediaManager::_manager', function ($view) use ($data) { - $view->with($data); - }); + // share + view()->composer('MediaManager::_manager', function ($view) use ($data) { + $view->with($data); + }); + } } /** diff --git a/src/resources/views/_manager.blade.php b/src/resources/views/_manager.blade.php index db705da..1a7cadc 100644 --- a/src/resources/views/_manager.blade.php +++ b/src/resources/views/_manager.blade.php @@ -93,7 +93,7 @@ class='hide-native-scrollbar' :hide-ext="{{ isset($hideExt) ? json_encode($hideExt) : '[]' }}" :hide-path="{{ isset($hidePath) ? json_encode($hidePath) : '[]' }}" :restrict="{{ isset($restrict) ? json_encode($restrict) : '{}' }}" - :user-id="{{ config('mediaManager.enable_broadcasting') ? auth()->user()->id : 0 }}" + :user-id="{{ config('mediaManager.enable_broadcasting') ? optional(auth()->user())->id : 0 }}" :upload-panel-img-list="{{ $patterns ?: '[]' }}">