diff --git a/app/Livewire/Forms/SongForm.php b/app/Livewire/Forms/SongForm.php index f647887..18f66a3 100644 --- a/app/Livewire/Forms/SongForm.php +++ b/app/Livewire/Forms/SongForm.php @@ -12,12 +12,13 @@ use App\Enums\SongLanguageType; use App\Enums\SongSituation; use App\Models\Song; use App\Models\SongCategory; +use App\Jobs\ExportSqliteSongLibraryCacheJob; class SongForm extends Component { use WireUiActions; - protected $listeners = ['openModal','closeModal', 'deleteSong']; + protected $listeners = ['openModal','closeModal', 'deleteSong','synchronous']; public bool $canCreate; public bool $canEdit; @@ -90,6 +91,16 @@ class SongForm extends Component $this->resetFields(); $this->showModal = false; } + public function synchronous(): void + { + ExportSqliteSongLibraryCacheJob::dispatch(); + + $this->notification()->send([ + 'icon' => 'success', + 'title' => '歌庫_Cache 同步', + 'description' => '已經加入排程', + ]); + } public function save() { diff --git a/resources/views/livewire/header/song.blade.php b/resources/views/livewire/header/song.blade.php index 6453903..51b3be7 100644 --- a/resources/views/livewire/header/song.blade.php +++ b/resources/views/livewire/header/song.blade.php @@ -12,4 +12,11 @@ label="{{ __('songs.ImportData') }}" class="bg-green-600 text-white" /> + + \ No newline at end of file