About This Project

This project presents a variant of the comment system integrated into various models of any Laravel framework project.

The goal is to implement a simple content commenting system.

Entities:
News, Post, User, Comment.

Comments can be replied to – this is considered a separate comment, as is replying to a comment on a comment, etc.

API: Creating/reading posts and news.
CRUD comments on behalf of the user to a post/news/comment.

Requirements:
PHP 8.2+, Laravel 11+, MySQL 8+.

You can change all the entities by Postman on https://laravel-comments.saviv.site/api

API routes:

Title Method Url Params / Body Value
Login POST /login email / password user3@gmail.com / 11111111
Register POST /register name / email / password / password_confirmation
Logout POST /logout
After login you get the access_token in response. Put it in the Bearer Authorization Token.
Title Method Url Params / Body Value
Get post with comments GET /posts/{$postId}
Create new post POST /posts title / content
Update post PUT /posts/{$postId} title / content
Title Method Url Params / Body Value
Get news with comments GET /news/{$newsId}
Create new news POST /news title / content
Update news PUT /news/{$newsId} title / content
Title Method Url Params / Body Value
Get post comments GET /comments commentable_type / commentable_id / order_direction post/news / {$id} / asc/desc
Create new comment POST /comments commentable_type / commentable_id / text post/news / {$id} / 3~3000
Reply to comment POST /comments/{$commentId} text 3~3000
Get comment GET /comments/{$commentId}
Update comment PUT /comments/{$commentId} text 3~3000
Delete comment DELETE /comments/{$commentId}