Skip to content

Conversation

@mubbi
Copy link
Owner

@mubbi mubbi commented Jul 23, 2025

This pull request refactors the namespace structure for API resources and requests, introduces a new MetaResource class for improved meta data handling, and updates the GetArticlesController to align with these changes. The updates improve code organization and enhance the clarity of API responses.

Namespace Refactoring:

  • Renamed app/Http/Requests/Api/V1/Article/GetArticlesRequest.php to app/Http/Requests/V1/Article/GetArticlesRequest.php and updated the namespace to App\Http\Requests\V1\Article for consistency with the new structure.
  • Renamed app/Http/Resources/Api/V1/Article/ArticleResource.php to app/Http/Resources/V1/Article/ArticleResource.php and updated the namespace to App\Http\Resources\V1\Article.

Introduction of MetaResource:

  • Added a new MetaResource class in app/Http/Resources/MetaResource.php to encapsulate meta data transformation logic. This ensures a consistent structure for meta data in API responses.

Updates to GetArticlesController:

  • Updated the namespace imports in GetArticlesController.php to reflect the new structure and include MetaResource.
  • Modified the response structure in GetArticlesController to use MetaResource for the meta field, improving the readability and consistency of the meta data. [1] [2]

Updates to ShowArticleController:

  • Updated the namespace for ArticleResource in ShowArticleController.php to align with the new structure.

fixed the api responses for article API
@mubbi mubbi changed the base branch from main to develop July 23, 2025 07:56
@mubbi mubbi merged commit 0de982a into develop Jul 23, 2025
1 check passed
@mubbi mubbi deleted the fix/article-api-responses branch July 23, 2025 11:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants