Skip to content

Commit

Permalink
don't use directive as this breaks, use closure instead
Browse files Browse the repository at this point in the history
  • Loading branch information
aSeriousDeveloper committed Dec 12, 2024
1 parent 6af58e9 commit c9c2741
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 1 addition & 5 deletions resources/views/filament/fields/file-upload.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@
target="_blank"
size="sm"
outlined
@if(config('zeus-bolt.uploadVisibility') === 'private')
href="{{ $disk->temporaryUrl($file, now()->addMinute()) }}"
@else
href="{{ $disk->url($file) }}"
@endif
href="{{ $getUrl($file) }}"
>
{{ __('view file') .': '. $loop->iteration }}
</x-filament::link>
Expand Down
7 changes: 6 additions & 1 deletion src/Fields/Classes/FileUpload.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,18 @@ public static function getOptionsHidden(): array
public function getResponse(Field $field, FieldResponse $resp): string
{
$responseValue = filled($resp->response) ? Bolt::isJson($resp->response) ? json_decode($resp->response) : [$resp->response] : [];

$disk = Storage::disk(config('zeus-bolt.uploadDisk'));

$getUrl = fn($file) => config('zeus-bolt.uploadVisibility') === 'private'
? $disk->temporaryUrl($file, now()->addMinute())
: $disk->url($file);

return view('zeus::filament.fields.file-upload')
->with('resp', $resp)
->with('responseValue', $responseValue)
->with('field', $field)
->with('disk', $disk)
->with('getUrl', $getUrl)
->render();
}

Expand Down

0 comments on commit c9c2741

Please sign in to comment.