-
app/Ticket.php
Open in GitHubuse Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; use Spatie\MediaLibrary\HasMedia; use Spatie\MediaLibrary\InteractsWithMedia; use Spatie\MediaLibrary\MediaCollections\Models\Media; class Ticket extends Model implements HasMedia { use SoftDeletes, InteractsWithMedia, Auditable; // public function getAttachmentsAttribute() { return $this->getMedia('attachments'); } // }
-
resources/views/admin/tickets/show.blade.php
Open in GitHub// ... <td> @foreach($ticket->attachments as $attachment) <a href="{{ $attachment->getUrl() }}" target="_blank">{{ $attachment->file_name }}</a> @endforeach </td> // ...