Support the ongoing development of Laravel.io →
Authentication
Last updated 1 year ago.
0

Nobody has ideas?

0

I released a new version of Laratrust that supports multiple user models, i think it would help you with your problem.

0

nameless said: 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).

Just brainstorming here.

  1. You don't really need a "continue as guest", because anyone who doesn't log in is already a guest. You'll never have a "non-guest non-user" on your site. So all you're really looking for is something like a session ID/remember token that uniquely identifies them so that you can associate a shopping cart with them. Having said that: is your shopping cart always associated with a user? You may want to change that. Maybe a flag that indicates whether it's a user or a guest shopping cart, and then a field that indicates the user_id or session_id/remember_token. Maybe a pivot table. Whatever you'd like.

  2. Your guests should have their own table. You really don't want to pollute your user table with people who never make an account. If they never check out, they should never be users. If they never choose to put in a password, they should never be users. Migrate your new user info to the users table when they put in the password.

There are other aspects of this you should look at, like your invoice/shipping methods, but it looks like your problem can be solved by taking a good look at the way your data is being organized and putting it in a way that works rather than trying to force the Auth system to do extra things.

Last updated 7 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

nameless nameless Joined 26 Oct 2016

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.