芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/www/vendor/laravel/jetstream/src/Http/Livewire/LogoutOtherBrowserSessionsForm.php
password = ''; $this->dispatchBrowserEvent('confirming-logout-other-browser-sessions'); $this->confirmingLogout = true; } /** * Log out from other browser sessions. * * @param \Illuminate\Contracts\Auth\StatefulGuard $guard * @return void */ public function logoutOtherBrowserSessions(StatefulGuard $guard) { $this->resetErrorBag(); if (! Hash::check($this->password, Auth::user()->password)) { throw ValidationException::withMessages([ 'password' => [__('This password does not match our records.')], ]); } $guard->logoutOtherDevices($this->password); $this->deleteOtherSessionRecords(); $this->confirmingLogout = false; $this->emit('loggedOut'); } /** * Delete the other browser session records from storage. * * @return void */ protected function deleteOtherSessionRecords() { if (config('session.driver') !== 'database') { return; } DB::connection(config('session.connection'))->table(config('session.table', 'sessions')) ->where('user_id', Auth::user()->getAuthIdentifier()) ->where('id', '!=', request()->session()->getId()) ->delete(); } /** * Get the current sessions. * * @return \Illuminate\Support\Collection */ public function getSessionsProperty() { if (config('session.driver') !== 'database') { return collect(); } return collect( DB::connection(config('session.connection'))->table(config('session.table', 'sessions')) ->where('user_id', Auth::user()->getAuthIdentifier()) ->orderBy('last_activity', 'desc') ->get() )->map(function ($session) { return (object) [ 'agent' => $this->createAgent($session), 'ip_address' => $session->ip_address, 'is_current_device' => $session->id === request()->session()->getId(), 'last_active' => Carbon::createFromTimestamp($session->last_activity)->diffForHumans(), ]; }); } /** * Create a new agent instance from the given session. * * @param mixed $session * @return \Jenssegers\Agent\Agent */ protected function createAgent($session) { return tap(new Agent, function ($agent) use ($session) { $agent->setUserAgent($session->user_agent); }); } /** * Render the component. * * @return \Illuminate\View\View */ public function render() { return view('profile.logout-other-browser-sessions-form'); } }