How wasem328saleh/posts-management works
This Laravel application exposes a social-media API for authentication, administrator-managed accounts, posts, comments, images, and profiles. The main request path is a client request through the API controllers into repositories, which apply domain logic and return resource-shaped responses; Eloquent models represent persisted users and content. Post and comment model events also feed registered listeners. The README documents the API capabilities; sampled controller and repository code confirms some delegation and data handling, while several route and event-handler details were not sampled.
Main entry points: UserRepository.php Content operations · Post.php Posts · EventServiceProvider.php Event registration · User.php User accounts
Components 24
Identity and administration
- Authentication API
app/Http/Controllers/AuthController.php - Authentication logic
app/Repositories/Auth/AuthRepository.php - Admin API
app/Http/Controllers/AdminController.php - Account administration
app/Repositories/Admin/AdminRepository.php - User accounts
app/Models/User.php - Roles and permissions
app/Models/Role.php
Social content
- User API
app/Http/Controllers/UserController.php - Content operations
app/Repositories/User/UserRepository.php - Posts
app/Models/Post.php - Comments
app/Models/Comment.php - Images
app/Models/Image.php - Image cleanup job
app/Jobs/DeleteImagesPost.php - Application database
config/database.php
Events and responses
- Post response
app/Http/Resources/PostResource.php - Profile response
app/Http/Resources/UserInfoResource.php - API response helper
app/Traits/ApiResponderTrait.php - Shared utilities
app/Traits/GeneralTrait.php - Post-created event
app/Events/PostCreated.php - Post-cache event
app/Events/PostCache.php - AI-reply event
app/Events/AiReplyEvent.php - Event registration
app/Providers/EventServiceProvider.php - Cache listener
app/Listeners/ClearPostCache.php - AI-reply listener
app/Listeners/AiReplyListeners.php
Other components
- API client
Connections 37
- API client → Authentication API: logs in
- API client → Admin API: manages accounts
- API client → User API: manages content
- Authentication API → Authentication logic: delegates to
app/Http/Controllers/AuthController.php - Admin API → Account administration: delegates to
app/Http/Controllers/AdminController.php - User API → Content operations: delegates to
app/Http/Controllers/UserController.php - Authentication logic → User accounts: authenticates
app/Repositories/Auth/AuthRepository.php - Authentication logic → Profile response: formats profile
app/Repositories/Auth/AuthRepository.php - Authentication logic → API response helper: builds response
app/Repositories/Auth/AuthRepository.php - Account administration → User accounts: manages
app/Repositories/Admin/AdminRepository.php - Account administration → Roles and permissions: assigns roles
app/Repositories/Admin/AdminRepository.php - Account administration → API response helper: builds response
app/Repositories/Admin/AdminRepository.php - Content operations → Posts: reads and writes
app/Repositories/User/UserRepository.php - Content operations → Comments: manages comments
app/Repositories/User/UserRepository.php - Content operations → Images: manages images
app/Repositories/User/UserRepository.php - Content operations → User accounts: loads profiles
app/Repositories/User/UserRepository.php - Content operations → Post response: formats posts
app/Repositories/User/UserRepository.php - Content operations → Profile response: formats profile
app/Repositories/User/UserRepository.php - Content operations → Image cleanup job: dispatches cleanup
app/Repositories/User/UserRepository.php - Content operations → Shared utilities: uses utilities
app/Repositories/User/UserRepository.php - Content operations → API response helper: builds response
app/Repositories/User/UserRepository.php - Post response → Images: serializes images
app/Http/Resources/PostResource.php - Post response → Comments: serializes comments
app/Http/Resources/PostResource.php - Profile response → Post response: serializes posts
app/Http/Resources/UserInfoResource.php - User accounts → Posts: relates posts
app/Models/User.php - User accounts → Roles and permissions: relates roles
app/Models/User.php - Posts → Comments: has comments
app/Models/Post.php - Posts → Images: has images
app/Models/Post.php - Posts → Post-created event: emits on creation
app/Models/Post.php - Posts → Post-cache event: emits on change
app/Models/Post.php - Comments → AI-reply event: emits on creation
app/Models/Comment.php - Event registration → Post-created event: registers handlers
app/Providers/EventServiceProvider.php - Event registration → Post-cache event: registers handlers
app/Providers/EventServiceProvider.php - Event registration → AI-reply event: registers handlers
app/Providers/EventServiceProvider.php - Event registration → Cache listener: registers listener
app/Providers/EventServiceProvider.php - Event registration → AI-reply listener: registers listener
app/Providers/EventServiceProvider.php - Image cleanup job → Shared utilities: uses utilities
app/Jobs/DeleteImagesPost.php