Код: Выделить всё
public function updateValas()
{
$this->validate();
try {
Valas::find($this->editingId)->update($this->editingValas);
$this->closeEditModal();
session()->flash('message', 'Data Valas berhasil diperbarui.');
$this->dispatch('refreshValas'); // Menggunakan dispatch untuk update edit
} catch (\Exception $e) {
session()->flash('error', 'Terjadi kesalahan saat memperbarui data.');
}
}
Код: Выделить всё
protected $listeners = [
'refreshCounterRates' => 'refreshCounterRates',
'refreshVideo' => 'refreshVideo',
'refreshImage' => 'refreshImage',
'refreshValas' => 'refreshValas',
];
public function refreshValas()
{
\Log::info('refreshValas event received');
$valas = Valas::all()->toArray();
$totalValas = count($valas);
$halfCount = ceil($totalValas / 2);
$this->valasTable1 = array_slice($valas, 0, $halfCount);
$this->valasTable2 = array_slice($valas, $halfCount);
}
public function mount($playlistId)
{
$this->playlistId = $playlistId;
$this->refreshQueue();
$this->refreshValas();
$this->refreshCounterRates();
$this->refreshVideo();
$this->updateDateTime();
$this->updateLastUpdateTime();
$this->refreshImage();
}
Код: Выделить всё
#[On('refresh-valas')]
public function refreshValas()
{
\Log::info('refreshValas event received');
$valas = Valas::all()->toArray();
$totalValas = count($valas);
$halfCount = ceil($totalValas / 2);
$this->valasTable1 = array_slice($valas, 0, $halfCount);
$this->valasTable2 = array_slice($valas, $halfCount);
}
Надеюсь, я найду проблему и пойму, в чем дело.
Подробнее здесь: https://stackoverflow.com/questions/787 ... t-the-data