Video by Ajay yadav on YouTube · 22 min. We did not make this video and we do not host it — watching it here still counts as a view for the creator.
Implement a simple one‑to‑many relationship: a Post has many Comments. Create a Comment model and migration, then add comments() method in Post. Newbies often forget to set the foreign key column name, leading to SQLSTATE[42S22] errors.
In production, comments are a common interactive feature. Validate comment content, associate it with the authenticated user, and display them under each post using eager loading (Post::with('comments')->find($id)).
Sign in with WhatsApp, your phone number, email or Google. No password. The same account carries your progress, your certificates and anything else you do with Nexgino later.
Sign in to continueIt takes about fifteen seconds.