$uuid) { Entity::where('uuid', $uuid)->update(['panel_sort' => $index]); } // Confirm the save so the drag doesn't feel like a no-op. $this->dispatch('panel-reordered'); } public function render() { $tiles = Entity::query() ->whereIn('type', ['switch', 'light']) ->where('panel_hidden', false) ->with('device.room', 'state') ->orderByRaw('panel_sort IS NULL, panel_sort') ->orderBy('id') ->get(); return view('livewire.panel', ['tiles' => $tiles]); } }