Refactor featured image handling in Page model and update PagesTable: Renamed 'featured_image' to 'featured_image_url' in PagesTable for clarity. Added a new accessor method in the Page model to generate the URL for the featured image.

This commit is contained in:
Ümit Tunç
2025-09-27 14:19:48 -03:00
parent d54601cb6b
commit ee68472eab
3 changed files with 193 additions and 1 deletions
@@ -21,7 +21,7 @@ class PagesTable
{
return $table
->columns([
ImageColumn::make('featured_image')
ImageColumn::make('featured_image_url')
->label('Görsel')
->circular()
->size(40)
+9
View File
@@ -63,4 +63,13 @@ class Page extends Model
return '/' . $this->slug;
}
public function getFeaturedImageUrlAttribute()
{
if ($this->featured_image) {
return asset('storage/' . $this->featured_image);
}
return null;
}
}