state = $this->user->withoutRelations()->toArray(); $lastActivity = DB::table('sessions')->select('last_activity')->where('user_id', $this->user->id)->first()->last_activity; $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->emit('saved'); } public function updatedPhoto($newPhoto) { (Auth::user())->updateProfilePhoto($newPhoto); $this->emit('saved'); } /** * Delete user's profile photo. * * @return void */ public function deleteProfilePhoto() { Auth::user()->deleteProfilePhoto(); $this->emit('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'); } }