add full url for pictures

This commit is contained in:
2025-04-14 11:14:06 +03:30
parent b25ce4bfe2
commit a3600c68fa
3 changed files with 12 additions and 3 deletions

View File

@@ -2,8 +2,10 @@
namespace App\Models;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\MorphTo;
use Illuminate\Support\Facades\Storage;
class PointFile extends Model
{
@@ -38,4 +40,11 @@ class PointFile extends Model
{
return $this->morphTo();
}
protected function path(): Attribute
{
return Attribute::make(
get: fn($value) => $value == null ? null : Storage::disk('public')->url($value)
);
}
}