feat: add image_url
This commit is contained in:
@@ -17,4 +17,14 @@ class Promotion extends Model
|
|||||||
'start_at' => 'datetime',
|
'start_at' => 'datetime',
|
||||||
'end_at' => 'datetime'
|
'end_at' => 'datetime'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
protected $appends = ['image_url'];
|
||||||
|
|
||||||
|
public function getImageUrlAttribute()
|
||||||
|
{
|
||||||
|
if ($this->image) {
|
||||||
|
return Storage::disk('public')->url($this->image);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user