Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

orionweb's avatar

best aproach for public event registration form

I need to implement the below feature for my event management system. How best to approach this.

An public event is held and public participant can sign up to the event via a unique link (containing the EventID). The event would be pre-created by the coordinator prior to allowing public registration.

Public need to be able to register for the event (or future events under the same user ID). After registration they will be created an account (tied to email address) and need to login and update their fund raising effort (they get others to support them by raising funds).

We currently get them to Register using a Google Form but wants to migrate this to a Laravel App to be more automated and provide other features.

I'm not sure how to create a 'registration form' for user to register to participate to an event.

  1. The user needs to be able to enter all the relevant require details in one hit. 2)Once user register then normal account validation by email with unique link. So we don't get Spam registration. 3)The user may or may not have an existing account (from a previous year). If have existing account (tied to email) then prompt them to use that.

I've seen a few example of extending the default user registration form. However that only involve one or two extra filed that gets added as part of the Users table. I need to store info in other tables.

Thanks you.

0 likes
8 replies
orionweb's avatar

Hmm I'm not clicking that link clearly some spammy attempt or worst.

Snapey's avatar

Think about it again.. What if the 'visitor' (deliberately not calling them users) did not go through a registration process, how would you tackle it then?

Fill out a form, press send. Backend saves that data in the database. You problem is no more complicated than that?

orionweb's avatar

We might not be on the same page. What I’m try to achieve is as part of signing up as a new user & in one hit they also sign up for that particular event (event ID in url). They then have to click the validation link else they registration is. Not valid.

I do not want to force the user to click the registration validation first then take them to an event page to register for the event as that wouldn’t be a good user experience.

Also my question is how to do this code wise.

Thanks

stanjg's avatar

If I understand you correctly you want the user to automatically be signed up for the event after they've verified their email. My approach would be to put this in the cache, and then when a user is verified check the cache if you need to sign them up for an event.

You should put something like this in your controller that handles user registration:

public function register(Request $request) {
    // Run your normal code to register a user
    // And fetch an $event variable from the request    

    Cache::put('signup.'.$user->id, $event->id, 60);  // The last argument is the amount of minutes you want to keep it in the cache
}

Now when a user gets verified check if there is a key in the cache:

if (Cache::has('signup.'.$user->id) {
    $event = Event::find(Cache::get('signup.'.$user->id));
    // Now sign the user up to the event like you would normally do
}

As I said, this would probably my approach, there are numerous other ways to do this though.

Snapey's avatar

OK. an approach;

User fills out a form with their details and event details (event may be a link to the event already created)

You receive the form and ;

a) does the email address already exist? If not, create an entry in the Users table (unverified so they can't login yet). Store the event attendance request. Create a signed URL that contains reference to the attendance request and mail it to the user

When they click on the link in the email, you reload the event attendance, and the associated user. Set the user's status to verified and confirm the attendance at that event. Manually login the user so that they can review their account and set other preferences etc.

b) the email address does exist, and is verified, ask the user for their password and log them in. Confirm their attendance at the event.

c) the email address does exist but is not yet verified. Do the same as a)

d) the user is already logged in when they click on the link for the event. When showing them the form, recognise that they are already logged in and adapt the form appropriately. Add the event to their account immediately.

I'm sure there are lots of other paths to think about. None of this entails going through the standard 'Registration' flow.

orionweb's avatar

Thanks guys. Those are what I'm after. I did not know anything about the cache! I will read up on that. Would be nice to have the cache auto purge non confirmed registration as I'm sure the spam bots will have a go at it.

stanjg's avatar

The cache already gets cleaned up in the code that I posted. The 60 in the Cache::put method means that the entry will be removed from the cache after 60 minutes.

Glad that I could be helpful :)

Please or to participate in this conversation.