Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package-lock.json

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

22 changes: 22 additions & 0 deletions src/Filament/Pages/Auth/Login.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace Eclipse\Frontend\Filament\Pages\Auth;

use Filament\Pages\Auth\Login as BasePage;
use Illuminate\Support\Facades\App;

class Login extends BasePage
{
public function mount(): void
{
parent::mount();

if (App::environment('local')) {
$this->form->fill([
'email' => 'test@example.com',
'password' => 'test123',
'remember' => true,
]);
}
}
}
18 changes: 18 additions & 0 deletions src/Http/Middleware/RedirectAfterLogin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace Eclipse\Frontend\Http\Middleware;

use Closure;
use Illuminate\Http\Request;

class RedirectAfterLogin
{
public function handle(Request $request, Closure $next)
{
if ($request->routeIs('filament.frontend.auth.login')) {
session()->put('url.intended', '/');
}

return $next($request);
}
}
19 changes: 11 additions & 8 deletions src/Providers/FrontendPanelProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
use Eclipse\Core\Models\Site;
use Eclipse\Core\Services\Registry;
use Eclipse\Frontend\Filament\Pages as CustomPages;
use Eclipse\Frontend\Filament\Pages\Auth\Login;
use Eclipse\Frontend\Http\Middleware\RedirectAfterLogin;
use Filament\Http\Middleware\Authenticate;
use Filament\Http\Middleware\AuthenticateSession;
use Filament\Http\Middleware\DisableBladeIconComponents;
Expand Down Expand Up @@ -52,19 +54,19 @@ public function panel(Panel $panel): Panel
$middleware[] = AuthenticateSession::class;
$pages[] = CustomPages\Home::class;
} else {
$middleware[] = RedirectAfterLogin::class;
$widgets = array_merge($widgets, [
Widgets\AccountWidget::class,
Widgets\FilamentInfoWidget::class,
]);
$pages[] = Pages\Dashboard::class;
}

$panel
$panel = $panel
->id(self::PANEL_ID)
->path('')
->login()
->login(Login::class)
->passwordReset()
->emailVerification()
->colors([
'primary' => Color::Cyan,
'gray' => Color::Slate,
Expand Down Expand Up @@ -93,7 +95,11 @@ public function panel(Panel $panel): Panel
->middleware($middleware)
->plugins(array_merge([
EnvironmentIndicatorPlugin::make(),
], app(Registry::class)->getPlugins()));
], app(Registry::class)->getPlugins()))
->renderHook(
PanelsRenderHook::HEAD_START,
fn (): string => self::getThemeIsolationScript(self::PANEL_ID)
);

match ($this->allowGuestAccess()) {
true => $panel
Expand All @@ -105,10 +111,6 @@ public function panel(Panel $panel): Panel
->authMiddleware([
Authenticate::class,
])
->renderHook(
PanelsRenderHook::HEAD_START,
fn (): string => self::getThemeIsolationScript(self::PANEL_ID)
)
};

return $panel;
Expand All @@ -117,6 +119,7 @@ public function panel(Panel $panel): Panel
public function register(): void
{
parent::register();

FilamentView::registerRenderHook('panels::body.end', fn (): string => Blade::render("@vite('resources/js/app.js')"));
}

Expand Down