Skip to content

Commit

Permalink
fix 138
Browse files Browse the repository at this point in the history
  • Loading branch information
ctf0 committed Mar 9, 2020
1 parent 058427c commit 85ea416
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 23 deletions.
45 changes: 23 additions & 22 deletions src/MediaManagerServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
}
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/resources/views/_manager.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ?: '[]' }}">

<div class="media-manager"
Expand Down

0 comments on commit 85ea416

Please sign in to comment.