-
app/Livewire/Navigation/NotificationsCount/Show.php
Open in GitHubuse App\Models\User; use Illuminate\Http\Request; use Illuminate\View\View; use Livewire\Attributes\On; use Livewire\Component; final class Show extends Component { #[On('question.created')] #[On('question.updated')] #[On('question.reported')] #[On('question.ignored')] public function refresh(): void { // } public function render(Request $request): View { $user = type($request->user())->as(User::class); return view('livewire.navigation.notifications-count.show', [ 'count' => $user->notifications()->count(), ]); } }
-
app/Livewire/Questions/Create.php
Open in GitHubuse Illuminate\Http\Request; use Livewire\Attributes\On; use Livewire\Component; final class Create extends Component { // ... #[On([ 'link-settings.updated', 'question.created', ])] public function refresh(): void { // } public function store(Request $request): void { // ... $this->dispatch('question.created'); // ... } // ... }