From 25e1ddd1f412d0109336cecd4226880f667fbebc Mon Sep 17 00:00:00 2001 From: Amirmahdi Nourkazemi Date: Sat, 27 Sep 2025 13:18:37 +0330 Subject: [PATCH] fix: return image url in model template --- app/Models/BreathingTemplate.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/Models/BreathingTemplate.php b/app/Models/BreathingTemplate.php index 5526649..17f466d 100644 --- a/app/Models/BreathingTemplate.php +++ b/app/Models/BreathingTemplate.php @@ -12,7 +12,12 @@ public function user() { return $this->belongsTo(User::class); } + protected $appends = ['image_url']; + public function getImageUrlAttribute() + { + return $this->image ? asset('storage/' . $this->image->path) : null; + } public function sessions() { return $this->hasMany(UserBreathingSession::class, 'template_id');