Sunday, March 4, 2018

Laravel Guest User with additional login - development

Laravel Guest User with additional login

I would like to build a possibility to add register the guest user afterwards…

So the use case is like that>
The User gets a GuestAccount imediately when he opens the pages and is already logged in. Afterwads he gets a result that is linked to this Account
Then he decides to register and open up the page in another device where he needs a login inorder to get the same result from the original GuestAccount.

in StartController

        if(!Auth::check()){
            $user = User::create([
                'name' => 'guest', 
                'email' => 'guest@guest.com'
            ]);
            Auth::login($user, true);
        }
        return view('guest');

Afterwads the Auth::user() should be able to login one more time to his “real” account – if he has one.

How to achieve this?



from Laravel Questions and Answers https://laravelquestions.com/laravel/laravel-guest-user-with-additional-login/
via Lzo Media

No comments:

Post a Comment