fix: return image url in model template

This commit is contained in:
2025-09-27 13:18:37 +03:30
parent 84aad9b8e0
commit 25e1ddd1f4
+5
View File
@@ -12,7 +12,12 @@ public function user()
{ {
return $this->belongsTo(User::class); return $this->belongsTo(User::class);
} }
protected $appends = ['image_url'];
public function getImageUrlAttribute()
{
return $this->image ? asset('storage/' . $this->image->path) : null;
}
public function sessions() public function sessions()
{ {
return $this->hasMany(UserBreathingSession::class, 'template_id'); return $this->hasMany(UserBreathingSession::class, 'template_id');