Skip to main content

Black Friday 2025! Only until December 1st: coupon FRIDAY25 for 40% off Yearly/Lifetime membership!

Read more here

LaravelDaily/Laravel-Support-Ticketing

294 stars
2 code files
View LaravelDaily/Laravel-Support-Ticketing on GitHub

app/Ticket.php

Open in GitHub
use 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>
 
// ...

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.