26 lines
476 B
PHP
26 lines
476 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Support\Facades\Storage;
|
|
|
|
class InvoiceAttachment extends Model
|
|
{
|
|
protected $table = 'invoice_attachments';
|
|
|
|
protected $guarded = [];
|
|
|
|
protected $appends = ['url'];
|
|
|
|
public function invoice()
|
|
{
|
|
return $this->belongsTo(Invoice::class);
|
|
}
|
|
|
|
public function getUrlAttribute(): string
|
|
{
|
|
return Storage::disk($this->disk)->url($this->path);
|
|
}
|
|
}
|