state = $this->user->withoutRelations()->toArray(); $lastActivity = data_get( DB::table('sessions') ->select('last_activity') ->where('user_id', $this->user->id) ->first(), 'last_activity', 0 ); $this->isOnline = (now()->unix() - $lastActivity) < 150; } /** * Update the user's profile information. * * @param \Laravel\Fortify\Contracts\UpdatesUserProfileInformation $updater * @return void */ public function updateProfileInformation(UpdatesUserProfileInformation $updater) { $this->resetErrorBag(); $updater->update( Auth::user(), $this->photo ? array_merge($this->state, ['photo' => $this->photo]) : $this->state ); $this->dispatch('saved'); } public function updatedPhoto($newPhoto) { (Auth::user())->updateProfilePhoto($newPhoto); $this->dispatch('saved'); } /** * Delete user's profile photo. * * @return void */ public function deleteProfilePhoto() { Auth::user()->deleteProfilePhoto(); $this->dispatch('refresh-navigation-menu'); } /** * Get the current user of the application. * * @return mixed */ public function getUserProperty() { return $this->user; } public function render() { return view('livewire.profile.photo-form'); } }