Fix blog post image upload storage
This commit is contained in:
@@ -121,9 +121,10 @@ class PostResource extends Resource
|
||||
->unique(BlogPost::class, 'slug', ignoreRecord: true)
|
||||
->maxLength(255)
|
||||
->columnSpanFull(),
|
||||
FileUpload::make('featured_image')
|
||||
FileUpload::make('banner')
|
||||
->label('Featured Image')
|
||||
->image()
|
||||
->disk('public')
|
||||
->directory('blog')
|
||||
->visibility('public'),
|
||||
Select::make('blog_category_id')
|
||||
|
||||
@@ -63,12 +63,11 @@ class BlogPost extends Model
|
||||
}
|
||||
|
||||
$path = ltrim($this->banner, '/');
|
||||
if (str_starts_with($path, 'storage/')) {
|
||||
$path = substr($path, strlen('storage/'));
|
||||
}
|
||||
|
||||
return \URL::temporarySignedRoute(
|
||||
'api.v1.branding.asset',
|
||||
now()->addMinutes(30),
|
||||
['path' => $path]
|
||||
);
|
||||
return \Storage::disk('public')->url($path);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user