Skip to content

Commit

Permalink
feat: Session management (#24)
Browse files Browse the repository at this point in the history
* feat: Added session management
  • Loading branch information
lewislarsen authored Aug 17, 2024
1 parent 0d7127c commit 08f0acb
Show file tree
Hide file tree
Showing 10 changed files with 622 additions and 2 deletions.
21 changes: 21 additions & 0 deletions app/Livewire/Profile/SessionsPage.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

declare(strict_types=1);

namespace App\Livewire\Profile;

use Illuminate\View\View;
use Livewire\Component;

/**
* Manages the user's sessions page in the profile section.
* Renders the view using the 'account-app' layout.
*/
class SessionsPage extends Component
{
public function render(): View
{
return view('livewire.profile.sessions-page')
->layout('components.layouts.account-app');
}
}
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"require": {
"php": "^8.2",
"blade-ui-kit/blade-heroicons": "^2.3",
"cjmellor/browser-sessions": "^1.1",
"danharrin/livewire-rate-limiting": "^1.3",
"diglactic/laravel-breadcrumbs": "^9.0",
"laragear/two-factor": "^2.0",
Expand Down
268 changes: 267 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion config/session.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

return [

'driver' => env('SESSION_DRIVER', 'redis'),
'driver' => env('SESSION_DRIVER', 'database'),

'lifetime' => env('SESSION_LIFETIME', 120),

Expand Down
10 changes: 10 additions & 0 deletions resources/views/account/partials/sidebar.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@
</span>
</x-sidebar-nav-link>
</li>
@if (Config::get('session.driver') === 'database')
<li class="flex-1 lg:flex-initial">
<x-sidebar-nav-link :href="route('profile.sessions')" :active="request()->routeIs('profile.sessions*')" wire:navigate>
<span class="flex flex-col lg:flex-row items-center justify-center lg:justify-start py-2 lg:py-1.5">
@svg('heroicon-o-globe-alt', 'h-6 w-6 lg:h-5 lg:w-5 lg:mr-2')
<span class="text-xs mt-1 lg:mt-0 lg:text-sm">{{ __('Manage Sessions') }}</span>
</span>
</x-sidebar-nav-link>
</li>
@endif
<li class="flex-1 lg:flex-initial">
<x-sidebar-nav-link :href="route('account.remove-account')" :active="request()->routeIs('account.remove-account')" wire:navigate>
<span class="flex flex-col lg:flex-row items-center justify-center lg:justify-start py-2 lg:py-1.5">
Expand Down
Loading

0 comments on commit 08f0acb

Please sign in to comment.