fix: return image url in model template
This commit is contained in:
@@ -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');
|
||||||
|
|||||||
Reference in New Issue
Block a user