|
|
@@ -16,7 +16,7 @@ class AttachmentResource extends JsonResource
|
|
|
*/
|
|
|
public function toArray($request)
|
|
|
{
|
|
|
- $filename = $this->bucket.'/'.$this->name;
|
|
|
+ $filename = $this->bucket . '/' . $this->name;
|
|
|
$data = [
|
|
|
"id" => $this->id,
|
|
|
"user_uid" => $this->user_uid,
|
|
|
@@ -32,21 +32,21 @@ class AttachmentResource extends JsonResource
|
|
|
|
|
|
if (App::environment('local')) {
|
|
|
$data['url'] = Storage::url($filename);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
$data['url'] = Storage::temporaryUrl($filename, now()->addDays(2));
|
|
|
}
|
|
|
|
|
|
- $type = explode('/',$this->content_type);
|
|
|
- if($type[0] === 'image' || $type[0] === 'video') {
|
|
|
+ $type = explode('/', $this->content_type);
|
|
|
+ if ($type[0] === 'image' || $type[0] === 'video') {
|
|
|
$path_parts = pathinfo($this->name);
|
|
|
- $small = $this->bucket.'/'.$path_parts['filename'] . '_s.jpg';
|
|
|
- $middle = $this->bucket.'/'.$path_parts['filename'] . '_m.jpg';
|
|
|
+ $small = $this->bucket . '/' . $path_parts['filename'] . '_s.jpg';
|
|
|
+ $middle = $this->bucket . '/' . $path_parts['filename'] . '_m.jpg';
|
|
|
if (App::environment('local')) {
|
|
|
$data['thumbnail'] = [
|
|
|
- 'small'=>Storage::url($small),
|
|
|
- 'middle'=>Storage::url($middle),
|
|
|
+ 'small' => Storage::url($small),
|
|
|
+ 'middle' => Storage::url($middle),
|
|
|
];
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
$data['thumbnail'] = [
|
|
|
'small' => Storage::temporaryUrl($small, now()->addDays(2)),
|
|
|
'middle' => Storage::temporaryUrl($middle, now()->addDays(2)),
|