jaracas's avatar

jaracas wrote a reply+100 XP

5mos ago

I think I fixed it, however Debugbar still says it's hitting /dashboard before /characters/creator.

For people coming here in the future, I had to add:

return Inertia::render('game/character/Create'); 

Then make the vue, add some content to it, then run npm build

jaracas's avatar

jaracas wrote a reply+100 XP

5mos ago

I've updated my Providers\FortifyServiceProvider.php to:

However it still isn't working

edit: I've made some progress, now I get a modal popup that says "App\Http\Responses\LoginResponse"

My code: App\Http\Responses:

<?php

namespace App\Http\Responses;

use Laravel\Fortify\Contracts\LoginResponse as LoginResponseContract;

class LoginResponse implements LoginResponseContract
{
    /**
     * @param  $request
     * @return mixed
     */
    public function toResponse($request)
    {
        $user = auth()->user();

        if ($user && $user->characters()->count() > 0) {
            return redirect()->intended('/characters');
        }

        return redirect()->intended('/characters/creator');
    }
}

FortifyServiceProvider:

    public function register(): void
    {
        // https://laravel-news.com/override-login-redirects-in-jetstream-fortify
        $this->app->instance(LoginResponseContract::class, LoginResponse::class);
        $this->app->instance(TwoFactorLoginResponse::class, LoginResponse::class); // singleton
    }

edit 2: After some research, I figured out it IS redirecting to where I want, but it re-redirects to /dashboard after that?

jaracas's avatar

jaracas liked a comment+100 XP

5mos ago

I updated my answer since I realized you're using Fortify. Check the edit at the end.

jaracas's avatar

jaracas wrote a reply+100 XP

5mos ago

I don't have any auth controllers, in previous versions they were in Controllers\Auth I believe, but now I don't have any. How do I publish them?

jaracas's avatar

jaracas wrote a reply+100 XP

5mos ago

I saw that in another thread while trying to solve things, however it never seems to work for me. What am I doing wrong? All it does is redirect me to /dashboard

jaracas's avatar

jaracas started a new conversation+100 XP

5mos ago

I'm struggling to figure out how to add logic to redirect users after they login to different pages depending on whether they have data in another table or not.

I need to be able to redirect users after they login using the Laravel built-in auth (Vue starter kit not using WorkOS). Where exactly is the logic that determines where the user is sent after logging in? Right now no matter what I do it redirects to /dashboard.

jaracas's avatar

jaracas wrote a reply+100 XP

5mos ago

Thanks for the reply, would you suggest using Reverb + Redis? Am I wrong in thinking that Reverb keeps your code in memory and uses websockets instead of having the client make a request every time it needs updated data?

jaracas's avatar

jaracas started a new conversation+100 XP

5mos ago

I'm starting a new personal project that will have multiple (As many as 10, possibly more) components that need to be updated every 250-500ms with updated data, all the data is pretty lightweight but with 10 components doing it I have to wonder if it'd be better to just use Laravel as an API and poll the server myself with something like axios.

For the record, my project is a PBBG (Persistent Browser-Based Game), and components will be for things like player health, stamina, currency, a list of players in the same area, etc..

"Shared Data" seems like it may be a solution since it looks like I can just write a middleware that sends the necessary data every update conditionally. Would using this be a good idea, or should I just roll my own solution?