olivsinz's avatar

olivsinz liked a comment+100 XP

3mos ago

There is a series that covers this, you can find it here

https://laracasts.com/series/modular-laravel

olivsinz's avatar

olivsinz liked a comment+100 XP

5mos ago

Update your withMiddleware block in bootstrap/app.php

use \Illuminate\Auth\Middleware\RedirectIfAuthenticated;


// ...
->withMiddleware(function (Middleware $middleware) {
    RedirectIfAuthenticated::redirectUsing(fn() => route('your-route-name'));
})

You can also change the post-login redirect in the resources/views/livewire/auth/login.blade.php Volt file if needed:

$this->redirectIntended(default: route('your-route-name', absolute: false), navigate: true);
olivsinz's avatar

olivsinz liked a comment+100 XP

5mos ago

I'm using the Laravel 12 Livewire starter kit.

I wanted to change the dashboard name to something else, but I see the auth redirect url is hardcoded to look for dashboard and home somewhere deep in the framework. So if I visit /login after already being authenticated, it redirects me to /dashboard, and if I change the dashboard route and name it takes me to the front page instead.

Is there an easy way to change this, should I create my own middleware perhaps? I could change the url and keep the name dashboard, but I'm hoping there's an easy solution. I was hoping I could just override the default function or something.

olivsinz's avatar

olivsinz wrote a reply+100 XP

5mos ago

Thanks for sharing

olivsinz's avatar

olivsinz liked a comment+100 XP

5mos ago

I am encountering a 410 Page Expired issue on my subdomain while working with a project running in production on primarydomain.com. My setup includes a subdomain test.primarydomain.com for testing, and everything works fine on the primary domain and locally (thankfully). However, on the subdomain, I am facing this "Page Expired" issue, especially with forms. On the test server, which is hosted at test.primarydomain.com I have configured the .env file with the following:

SESSION_DRIVER=database
SESSION_DOMAIN=.primarydomain.com   or SESSION_DOMAIN=test.primarydomain.com  or SESSION_DOMAIN=null
SESSION_LIFETIME=120

In the production domain i.e. primarydomain.com the .env is configured as:

SESSION_DRIVER=database
SESSION_DOMAIN=primarydomain.com 
SESSION_LIFETIME=120

Despite these settings, I cannot seem to resolve the issue. The odd part is that if I clear both the browser cache and the project cache (using the artisan command), it randomly allows me to log in once. However, once I log out, the issue reappears, and I get stuck with the "Page Expired" error every time I try to log in again. To clarify, I have already included the @csrf directive in all forms, and as mentioned, everything works fine on the primary domain and in the local setup, but the problem persists specifically on the subdomain. Any help on resolving this would be greatly appreciated!