feat(blog): ensure RealBlogContentSeeder runs reliably on boot when new articles are detected
Deploy Backend / deploy (push) Successful in 46s
Deploy Backend / deploy (push) Successful in 46s
This commit is contained in:
1 parent
27231a091e
commit
5fb68a4464
1 file changed
+17
-1
@@ -19,7 +19,23 @@ class AppServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
//
|
||||
// One-time self-healing sync of blog seed content when missing
|
||||
try {
|
||||
if (\Illuminate\Support\Facades\Schema::hasTable('posts')) {
|
||||
$hasGitPost = \Illuminate\Support\Facades\DB::table('posts')
|
||||
->where('slug', 'git-mental-model-and-battle-tested-habits-fa')
|
||||
->exists();
|
||||
if (!$hasGitPost) {
|
||||
\Illuminate\Support\Facades\Artisan::call('db:seed', [
|
||||
'--class' => 'Database\\Seeders\\Blog\\RealBlogContentSeeder',
|
||||
'--force' => true,
|
||||
]);
|
||||
\Illuminate\Support\Facades\Cache::flush();
|
||||
}
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
// Silently fall through if DB or migration is in flux
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user