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

Heyaj05's avatar

How and Where would I put a function to redirect based on if a table profile has been filed?

Basically I have three tables related to filling a profile, I want to ensure when the first time a user registers they will always go that page. I know that can be done by changing the redirect variable

But what if they logout after registering and then sign back in, I want to make sure they always get redirected no matter where they go if these three tables aren't filled.

Would I create a function in a middle ware somewhere?

Pretty new to all this stuff, so learning as much as I can

0 likes
2 replies
Heyaj05's avatar

Thats what I ended up doing. Then in the controller files I call the middleware except on the function create.

The other question I had regarding this was, now I have three (profile) tables that get populated before the user can use the website.

Now would I need three middleware for each table, due to the fact they can go to any create function on either one ?

Please or to participate in this conversation.