mirror of
https://github.com/dyzulk/trustlab-api.git
synced 2026-01-26 13:22:05 +07:00
feat: Implement Secure R2 Storage with Private Bucket and Proxy Controller
This commit is contained in:
@@ -22,4 +22,18 @@ class TicketAttachment extends Model
|
||||
{
|
||||
return $this->belongsTo(TicketReply::class, 'ticket_reply_id');
|
||||
}
|
||||
|
||||
protected $appends = ['download_url'];
|
||||
|
||||
public function getDownloadUrlAttribute()
|
||||
{
|
||||
// Legacy: if it's already a full URL, return it
|
||||
if (filter_var($this->file_path, FILTER_VALIDATE_URL)) {
|
||||
return $this->file_path;
|
||||
}
|
||||
|
||||
// Secure: return the API endpoint
|
||||
// Assuming route prefix is /api (standard Laravel)
|
||||
return url("/api/support/attachments/{$this->id}");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user