Skip to content

Commit

Permalink
fixed hasMany HasOne inner fields
Browse files Browse the repository at this point in the history
  • Loading branch information
lee-to committed Nov 24, 2022
1 parent c40d3a4 commit aa9779a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 4 additions & 2 deletions resources/views/fields/file.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
@include('moonshine::fields.shared.file', [
'index' => $index+1,
'canDownload' => $field->canDownload(),
'value' => $file
'value' => $file,
'field' => $field,
])

@if($field->isRemovable())
Expand All @@ -27,7 +28,8 @@
@else
@include('moonshine::fields.shared.file', [
'canDownload' => $field->canDownload(),
'value' => $field->formViewValue($item)
'value' => $field->formViewValue($item),
'field' => $field,
])
@endif
@endif
Expand Down
7 changes: 6 additions & 1 deletion resources/views/fields/shared/file.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@

@if($canDownload)
<div class="ml-4 flex-shrink-0">
<a href="{{ Storage::url($value) }}" download
<a @if(isset($field) && $field->attributes()->has('x-model'))
:href="({{ $field->attributes()->get('x-model') }}) ? ('{{ Storage::url('') }}' + {{ $field->attributes()->get('x-model') }}) : ''"
@else
href="{{ Storage::url($value) }}"
@endif
download
class="font-medium text-pink hover:text-pink transition duration-150 ease-in-out">
{{ trans('moonshine::ui.download') }}
</a>
Expand Down

0 comments on commit aa9779a

Please sign in to comment.