running = true; $src = config('blog.sablog_source'); try { Artisan::call('sablog:import', [ '--host' => $src['host'], '--port' => $src['port'], '--database' => $src['database'], '--username' => $src['username'], '--password' => $src['password'], '--prefix' => $src['prefix'], ]); $output = trim(Artisan::output()); PageCacheMiddleware::flush(); Notification::make() ->title('旧站数据同步完成') ->body(Str::afterLast($output, '报告:') ?: $output) ->success() ->persistent() ->send(); } catch (\Throwable $e) { Notification::make() ->title('同步失败') ->body($e->getMessage()) ->danger() ->persistent() ->send(); } $this->running = false; } public function render(): \Illuminate\Contracts\View\View { return view('livewire.legacy-sync-button'); } }