validate([ 'photo' => 'image|mimes:jpg,jpeg,png|max:1024', // 1MB Max ]); } /** * When the cover is temporarily uploaded. */ public function updatedCover(): void { $this->validate([ 'cover' => 'image|mimes:jpg,jpeg,png|max:2048', // 2MB Max ]); } /** * Update the user's profile information. */ public function updateProfileInformation(UpdatesUserProfileInformation $updater): RedirectResponse|Redirector|null { $this->resetErrorBag(); $updater->update( Auth::user(), $this->photo || $this->cover ? array_merge($this->state, array_filter([ 'photo' => $this->photo, 'cover' => $this->cover, ])) : $this->state ); if (isset($this->photo) || isset($this->cover)) { return redirect()->route('profile.show'); } $this->dispatch('saved'); $this->dispatch('refresh-navigation-menu'); return null; } /** * Delete user's profile photo. */ public function deleteCoverPhoto(): void { Auth::user()->deleteCoverPhoto(); $this->dispatch('refresh-navigation-menu'); } }