Skip to content

Conversation

@mubbi
Copy link
Owner

@mubbi mubbi commented Jul 19, 2025

This pull request introduces a new MeController to handle the /me endpoint, replacing the previous inline route logic. It also updates the UserResource to improve handling of token-related attributes, adds a new success message to the localization file, and includes a feature test for the new controller. Below are the most important changes grouped by theme:

New Controller for /me Endpoint:

  • Added MeController in app/Http/Controllers/Api/V1/User/MeController.php to handle authenticated user profile requests. This includes loading user roles and permissions and returning a structured JSON response.
  • Updated the /me route in routes/api_v1.php to use the new MeController instead of inline logic.

Enhancements to UserResource:

  • Modified UserResource in app/Http/Resources/V1/Auth/UserResource.php to check for token-related attributes using array_key_exists and provide default values for optional attributes.

Localization Update:

  • Added a new success message 'success' => 'Response returned successfully.' to lang/en/common.php.

Feature Test for /me Endpoint:

  • Added a new feature test in tests/Feature/API/V1/User/MeControllerTest.php to verify that the /me endpoint returns the authenticated user's profile with roles and permissions.

@mubbi mubbi merged commit 6bae7b1 into develop Jul 19, 2025
2 checks passed
@mubbi mubbi deleted the feature/user-me-controller branch July 23, 2025 11:15
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