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

christogonus's avatar

How to drip feed content to user from date of registration

I am building a fitness plan website where I deliver 24-weeks fitness plan. Now, I have all content in database for user with subscription. But I do not want user to access everything from the date of registration.

I want to show 7 plans the first week of subscription, then the next 7 will be available from second week, etc.

I am confused how to achieve this properly. I have even tried to think: "How will @JeffreyWay do this?" and nothing came to mind :(

How would you do this?

0 likes
2 replies
tykus's avatar

You can calculate the number of weeks since the User was registered. Then use that to calculate an offset for the query:

$weeksSinceRegistration = today()->diffInWeeks($user->registered_at);

$plans = Plan::take(7)->skip($weeksSinceRegistration * 7)->get();
1 like
christogonus's avatar

@tykus Thanks for your help, but I have a little more complicated case haha.

I have a monthly billing cycle, and user can cancel renewal.

  • if week 1 subscribed, show week 1 plan (7 action plans)
  • if week 2, show week 2 also
  • if week 3, show week 3 also
  • if week 4, show week 4.

Now, if user cancels subscription after 30 days, and then come back after 4 months and renews, I want the system to start showing from "week 5 data".

I don't know if modifying my 'Database' to category->subcategory relationship with the fitness lessons will be an optimal way to do this.

  • Category will now be "months", like month 1, month 2, month 3, month 3
  • Subcategories will be "Month 1" -> "Week 1", "Month 1" -> "Week 2", etc
  • plans will be "Month 1" -> "Week 1" -> "Day 1", "Month 1" -> "Week 1" -> "Day 2", etc

My head is really spinning to know what will work for my case.

Please or to participate in this conversation.