feat(cms): sync site assets, revalidate webhook, and document download naming
This commit is contained in:
@@ -6,6 +6,7 @@ use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class Article extends Model
|
||||
@@ -47,6 +48,7 @@ class Article extends Model
|
||||
'status',
|
||||
'access_level',
|
||||
'featured_image_path',
|
||||
'featured_image_storage_path',
|
||||
'featured_image_alt',
|
||||
'author_name',
|
||||
'author_user_id',
|
||||
@@ -447,7 +449,12 @@ class Article extends Model
|
||||
return null;
|
||||
}
|
||||
|
||||
// Return relative path for Next.js frontend (images served from public/)
|
||||
// Admin-uploaded images stored in Laravel storage
|
||||
if (str_starts_with($this->featured_image_path, 'articles/')) {
|
||||
return Storage::disk('public')->url($this->featured_image_path);
|
||||
}
|
||||
|
||||
// Migrated images — relative path (served from Next.js public/)
|
||||
return '/'.$this->featured_image_path;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user