芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/www/vendor/laravel/jetstream/src/Http/Controllers/Inertia/UserProfileController.php
render($request, 'Profile/Show', [ 'sessions' => $this->sessions($request)->all(), ]); } /** * Get the current sessions. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Support\Collection */ public function sessions(Request $request) { if (config('session.driver') !== 'database') { return collect(); } return collect( DB::connection(config('session.connection'))->table(config('session.table', 'sessions')) ->where('user_id', $request->user()->getAuthIdentifier()) ->orderBy('last_activity', 'desc') ->get() )->map(function ($session) use ($request) { $agent = $this->createAgent($session); return (object) [ 'agent' => [ 'is_desktop' => $agent->isDesktop(), 'platform' => $agent->platform(), 'browser' => $agent->browser(), ], '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); }); } }