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

ebukz's avatar

Laravel5 Twitter Design Architecture [HELP] !!

So i'm new to Laravel coming from a Java background. I am designing a Laravel App for students similar to Twitter. The idea is that students have a timeline for them to make posts on their course timeline(students in their course), university timeline(all students), city timeline...

Basic DB architecture so far:

  1. Core Models: course, university, city, hobby, accomodation will have individual tables

2)Posts table will have its own seperate table with the course_id, university_id ... as foreign keys to it. There would be a polymorphic relation that identifies the Core Model the post belongs to and its ID i.e. Postable_id and Postable_type

  1. Timeline table will contain post_ID and Uni_ID(nullable) to identify what timeline posts from courses, hobbies and university acomodations should be placed seeing that they are university dependent.

Implementation Plan

  1. I have been able to successfully follow this tutorial for real time socket broadcasting https://laracasts.com/discuss/channels/general-discussion/step-by-step-guide-to-installing-socketio-and-broadcasting-events-with-laravel-51

  2. UserPosting will involve creating a command or Job which will be queued (since students can be making thousands of posts per second). This will then fire a UserPostedEvent to broadcast the post to TimelineListener class using the unique timeline_id.

Can anyone give an insight to a better design or advice on how to go about implementing (2)

0 likes
0 replies

Please or to participate in this conversation.