Feature/get articles api #22
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces a new feature for articles API, including support for retrieving articles with filtering, pagination, and detailed resource representation. It also adds relationships for articles with categories, tags, and authors. The key changes are grouped into the following themes:
New Controllers for Articles API
GetArticlesControllerto handle paginated retrieval of articles with filtering options, returning a structured JSON response.ShowArticleControllerto retrieve a specific article by its slug, with detailed error handling for not found and server errors.Request Validation and Resource Representation
GetArticlesRequestto validate and provide default values for article filtering and pagination parameters.ArticleResourceto transform article models into a standardized JSON structure, including relationships like author, categories, tags, and authors.Database Relationships for Articles
Articlemodel to includecategories,tags, andauthorsrelationships usingBelongsToMany.CategoryandTagmodels to definearticlesas aBelongsToManyrelationship. [1] [2]Article Service for Business Logic
ArticleServiceto encapsulate the logic for retrieving articles with filters, sorting, and pagination, as well as fetching a single article by slug.API Routes and Localization
api_v1.phpfile.common.php.