Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
RezDev94 committed May 24, 2021
1 parent c439ab8 commit 184d0f8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/Medium.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ class Medium extends Model

public function getPathAttribute($value)
{
$media_url = trim((empty(config('atriatech_media.media_url'))) ? url() : config('atriatech_media.media_url'), '/');
$media_url = trim((empty(config('atriatech_media.media_url'))) ? url('/') : config('atriatech_media.media_url'), '/');
$path = url(trim(config('atriatech_media.url_prefix'), '/') . Storage::url($value));
return str_replace(trim(url(), '/'), $media_url, $path);
return str_replace(trim(url('/'), '/'), $media_url, $path);
}

public function scopePath($query, $paths = null)
Expand All @@ -37,12 +37,12 @@ public function getOptionsAttribute($value)
$options = (array)json_decode($value);

$newOptions = [];
$media_url = trim((empty(config('atriatech_media.media_url'))) ? url() : config('atriatech_media.media_url'), '/');
$media_url = trim((empty(config('atriatech_media.media_url'))) ? url('/') : config('atriatech_media.media_url'), '/');
if (!empty($options['subSizes'])) {
$subSizes = (array)$options['subSizes'];
foreach($subSizes as $key => $subSize) {
$path = url(trim(config('atriatech_media.url_prefix'), '/') . Storage::url($subSize));
$subSizes[$key] = str_replace(trim(url(), '/'), $media_url, $path);
$subSizes[$key] = str_replace(trim(url('/'), '/'), $media_url, $path);
}
$newOptions['subSizes'] = $subSizes;
}
Expand Down
2 changes: 1 addition & 1 deletion src/config/atriatech_media.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,5 @@
* media URL.
* default is url()
*/
'media_url' => url(),
'media_url' => '',
];

0 comments on commit 184d0f8

Please sign in to comment.