Harden
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
@props(['type', 'id', 'kind' => 'general'])
|
||||
|
||||
<form method="POST" action="{{ route('attachments.store') }}" enctype="multipart/form-data" class="mt-4 space-y-3 rounded border p-4">
|
||||
@csrf
|
||||
<input type="hidden" name="attachable_type" value="{{ $type }}">
|
||||
<input type="hidden" name="attachable_id" value="{{ $id }}">
|
||||
<input type="hidden" name="kind" value="{{ $kind }}">
|
||||
<x-field name="caption" label="Caption" />
|
||||
<input type="file" name="file" required class="block w-full text-sm">
|
||||
<x-primary-button>Upload file</x-primary-button>
|
||||
</form>
|
||||
@@ -0,0 +1,12 @@
|
||||
@props(['attachments'])
|
||||
|
||||
@if ($attachments->count())
|
||||
<div class="mt-4 grid gap-3 md:grid-cols-2">
|
||||
@foreach ($attachments as $attachment)
|
||||
<a href="{{ asset('storage/'.$attachment->path) }}" class="block rounded border p-3 text-sm" target="_blank">
|
||||
<span class="font-semibold">{{ $attachment->original_name }}</span>
|
||||
<span class="block text-gray-500">{{ $attachment->caption }}</span>
|
||||
</a>
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
Reference in New Issue
Block a user