From 5c030bb639705a48cb4c00dbb5c5ba1bab0937ea Mon Sep 17 00:00:00 2001 From: AmirmahdiNourkazemi Date: Tue, 25 Nov 2025 16:13:42 +0330 Subject: [PATCH] feat: add image_url --- app/Models/Promotion.php | 10 ++++++++++ 1 file changed, 10 insertions(+) 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; + } }