diff --git a/app/Models/Promotion.php b/app/Models/Promotion.php index 6a21a7b..670c353 100644 --- a/app/Models/Promotion.php +++ b/app/Models/Promotion.php @@ -17,4 +17,14 @@ class Promotion extends Model 'start_at' => 'datetime', 'end_at' => 'datetime' ]; + + protected $appends = ['image_url']; + + public function getImageUrlAttribute() + { + if ($this->image) { + return Storage::disk('public')->url($this->image); + } + return null; + } }