Laravel 5.3 Auth - Possibility to register and log in but also to continue as gu...
I'm currently developing a website with Laravel, where users can register and afterwards login in order to do something on my page.
Now, I'm planning to introduce the possibility to proceed as a guest, so they can "Login as Guest" and then proceed like a normal user (but without the possibility to permanently save information they enter there). Also, they should be always able to change this Guest account to a permanent account by entering their mail-address as well as a password. I thought about simply creating a new user in db when clicking on login as guest, like a normal registered user and afterwards deleting it, but I'm not sure if that is possible to easy... Is there any way to "easily" do this or do you have any ideas on how to do it?
The registered user should be able to do lots of things like changing their addresses, informations, submit a ticket, sign up for newsletter, etc..., guests will only be able to put something in their shopping cart and buy it (and while buying they should be able to create a account as well..)
Also I know that I might need to implement a custom guard to authentificate a guest user (because normally they will need a password, I only want them to enter their mail adress to "log in". But ofcourse I need a session key to be generated etc., so this is the guards part then... But what do I need to do to create such a custom guard that fullfills my issues? I found the laravel doc for this (https://laravel.com/docs/5.3/authentication#adding-custom-guards), but can't really combine it with my problem....
PS: I'm using Laratrust for different roles within the page, so with that I might be able to show different menus or other information for a guest user after logging in with their mail adress. But still, the question is how to do it...
Thx for any help!
Edit: After thinking about it again, I want to get it a bit clearer. I basically plan to change the login page and add a button like "proceed as guest" and define a route like guestLogin for it. This route would point to a controller that somehow logs in using a (propably selfmade) auth. When clicking the button, a entry is added into the users table in my database, with only an idea and a remember token. Then, the guest user can place products in his shopping cart and can order something. In the order process, he needs to enter his personal information like his adress, email-adress, etc. He then also has the option check a checkbox to automatically register then by entering a password. Then his information is saved into the db as well (on the row created for the guest user).
PS: Again on Laratrust, I would create a guest role to show exactly the pages I want him to show, as well as custom checkout pages. So the only real problem is the login (by a custom auth guard, which I have no idea how to implement it) as well as later on registering for a user basically already existing (even if its just the ID in db so far).
I hope you got my idea.
Want to reply to this thread?Login with github.