26 lines
542 B
PHP
26 lines
542 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Support\Facades\Storage;
|
|
|
|
class ServiceAttachment extends Model
|
|
{
|
|
public const UPLOAD_RULE = 'required|file|mimes:jpg,jpeg,png,gif,webp,pdf,doc,docx,xls,xlsx,zip|max:51200';
|
|
|
|
protected $guarded = [];
|
|
|
|
protected $appends = ['url'];
|
|
|
|
public function service()
|
|
{
|
|
return $this->belongsTo(Service::class);
|
|
}
|
|
|
|
public function getUrlAttribute(): string
|
|
{
|
|
return Storage::disk($this->disk)->url($this->path);
|
|
}
|
|
}
|