### Starting New Laravel Project with Docker Source: https://github.com/ronasit/laravel-empty-project/blob/development/docker/Readme.md Commands to clone a Laravel project, start Docker containers, update dependencies, and run database migrations. Assumes Docker and Docker Compose are installed and configured. ```bash git clone ... docker-compose up docker ps docker exec -it .. composer update docker exec -it .. php artisan init docker exec -it .. php artisan migrate ``` -------------------------------- ### Granting Docker Permissions without Sudo Source: https://github.com/ronasit/laravel-empty-project/blob/development/docker/Readme.md Commands to add the 'docker' group and grant the current user permissions to run Docker commands without sudo. This is useful for simplifying Docker operations. ```bash sudo groupadd docker sudo gpasswd -a $USER docker docker run hello-world ``` -------------------------------- ### Settings Management - Get Setting Source: https://context7.com/ronasit/laravel-empty-project/llms.txt Retrieves a specific setting by name. Non-admin users can only access public settings, while admins can access all settings. ```APIDOC ## GET /api/v0.1/settings/{name} ### Description Retrieves a specific setting by name. Non-admin users can only access public settings, while admins can access all settings. ### Method GET ### Endpoint `/api/v0.1/settings/{name}` #### Path Parameters - **name** (string) - Required - The name of the setting to retrieve. ### Response #### Success Response (200 OK) Returns the setting object. - **name** (string) - The name of the setting. - **value** (any) - The value of the setting. Can be any valid JSON data. - **is_public** (boolean) - Indicates if the setting is publicly accessible. ### Response Example ```json { "name": "app_name", "value": { "title": "My Application", "version": "1.0.0" }, "is_public": true } ``` ``` -------------------------------- ### Setting Service Methods - Laravel PHP Source: https://context7.com/ronasit/laravel-empty-project/llms.txt Illustrates the usage of the SettingService for managing key-value settings with dot notation support in Laravel. Includes setting, getting (with defaults), updating, and checking for the existence of settings. Requires the SettingService and an active Laravel application context. ```php set('app_name', 'My Application'); // Get a setting with default value $appName = $settingService->get('app_name', 'Default App'); // Set nested settings using dot notation $settingService->set('config.email.host', 'smtp.example.com'); $settingService->set('config.email.port', 587); // Get nested setting $emailHost = $settingService->get('config.email.host'); // Search settings with filters $settings = $settingService->search([ 'query' => 'email', 'page' => 1, 'per_page' => 10, 'order_by' => 'name' ]); // Update setting via repository pattern $settingService->update( ['name' => 'app_name'], ['value' => ['title' => 'Updated', 'version' => '2.0']] ); // Check if setting exists if ($settingService->exists(['name' => 'app_name'])) { // Setting exists } ``` -------------------------------- ### Get User API Request - Bash Source: https://context7.com/ronasit/laravel-empty-project/llms.txt Retrieves detailed information for a specific user by their ID. Supports eager loading of relationships, such as 'role', via the 'with' query parameter. Requires an Authorization token. ```bash curl -X GET http://localhost/api/v0.1/users/3?with[]=role \ -H "Authorization: Bearer TOKEN..." ``` -------------------------------- ### Get Specific Setting Value via API Source: https://context7.com/ronasit/laravel-empty-project/llms.txt Retrieves the value of a specific setting by its name. Non-admin users can only access settings marked as public, while administrators have access to all settings. ```bash curl -X GET http://localhost/api/v0.1/settings/app_name \ -H "Authorization: Bearer TOKEN..." ``` -------------------------------- ### User Profile - Get Profile Source: https://context7.com/ronasit/laravel-empty-project/llms.txt Retrieves the authenticated user's profile information. Available to any authenticated user for their own profile. ```APIDOC ## GET /api/v0.1/profile ### Description Retrieves the authenticated user's profile information. Available to any authenticated user for their own profile. ### Method GET ### Endpoint `/api/v0.1/profile` #### Query Parameters - **with[]** (string) - Optional - Specifies relationships to eager load (e.g., `role`). ### Response #### Success Response (200 OK) Returns the authenticated user's profile information. - **id** (integer) - The user's ID. - **name** (string) - The user's name. - **email** (string) - The user's email. - **role_id** (integer) - The ID of the user's role. - **role** (object) - The user's role object (if `with[]=role` is included). - **id** (integer) - The role's ID. - **name** (string) - The role's name. ### Response Example ```json { "id": 1, "name": "John Doe", "email": "john@example.com", "role_id": 2, "role": { "id": 2, "name": "User" } } ``` ``` -------------------------------- ### GET /api/v0.1/users/{id} - Get User Source: https://context7.com/ronasit/laravel-empty-project/llms.txt Retrieves detailed information about a specific user by ID. Supports eager loading of relationships via the 'with' query parameter. ```APIDOC ## GET /api/v0.1/users/{id} ### Description Retrieves detailed information about a specific user by ID. Supports eager loading of relationships via the 'with' query parameter. ### Method GET ### Endpoint /api/v0.1/users/{id} ### Parameters #### Path Parameters - **id** (integer) - Required - The unique identifier of the user. #### Query Parameters - **with[]** (string) - Optional - Specifies relationships to eager load (e.g., `role`). #### Header Parameters - **Authorization** (string) - Required - Bearer token for authentication (e.g., `Bearer TOKEN`). ### Request Example ```bash curl -X GET http://localhost/api/v0.1/users/3?with[]=role \ -H "Authorization: Bearer TOKEN..." ``` ### Response #### Success Response (200) - **id** (integer) - User's unique identifier. - **name** (string) - User's name. - **email** (string) - User's email address. - **role_id** (integer) - The ID of the user's role. - **role** (object) - Details of the user's role, if requested via 'with' parameter (can be null). - **id** (integer) - Role's unique identifier. - **name** (string) - Role's name. #### Response Example ```json { "id": 3, "name": "Admin User", "email": "admin@example.com", "role_id": 1, "role": { "id": 1, "name": "Administrator" } } ``` ``` -------------------------------- ### Get Authenticated User Profile via API Source: https://context7.com/ronasit/laravel-empty-project/llms.txt Retrieves the profile information for the currently authenticated user. This endpoint can be accessed by any authenticated user to view their own profile details, including associated roles. ```bash curl -X GET http://localhost/api/v0.1/profile?with[]=role \ -H "Authorization: Bearer TOKEN..." ``` -------------------------------- ### GET /api/v0.1/auth/refresh - Token Refresh Source: https://context7.com/ronasit/laravel-empty-project/llms.txt Refreshes an expired or soon-to-expire JWT token without requiring the user to re-authenticate. The old token is invalidated and a new token is issued. ```APIDOC ## GET /api/v0.1/auth/refresh ### Description Refreshes an expired or soon-to-expire JWT token without requiring the user to re-authenticate. The old token is invalidated and a new token is issued. ### Method GET ### Endpoint /api/v0.1/auth/refresh ### Parameters #### Header Parameters - **Authorization** (string) - Required - Bearer token for authentication (e.g., `Bearer YOUR_TOKEN`). #### Query Parameters - **remember** (boolean) - Optional - Determines if the session should be remembered. ### Request Example ```bash curl -X GET http://localhost/api/v0.1/auth/refresh \ -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9..." \ -H "Content-Type: application/json" \ -d '{ "remember": true }' ``` ### Response #### Success Response (200) - **token** (string) - The new JWT token. - **ttl** (integer) - The time-to-live for the token in minutes. - **refresh_ttl** (integer) - The time-to-live for the refresh token in minutes. #### Response Example ```json { "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.NEW_TOKEN...", "ttl": 60, "refresh_ttl": 20160 } ``` ``` -------------------------------- ### User Registration API Request - Bash Source: https://context7.com/ronasit/laravel-empty-project/llms.txt Creates a new user account and logs them in, returning authentication credentials. Requires name, email, password, and password confirmation. The response includes the JWT token and user information. ```bash curl -X POST http://localhost/api/v0.1/register \ -H "Content-Type: application/json" \ -d '{ "name": "Jane Smith", "email": "jane@example.com", "password": "MySecurePass123", "confirm": "MySecurePass123", "remember": false }' # Response: { "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...", "ttl": 60, "refresh_ttl": 20160, "user": { "id": 2, "name": "Jane Smith", "email": "jane@example.com", "role_id": 2, "role": null } } ``` -------------------------------- ### Create User API Request - Bash Source: https://context7.com/ronasit/laravel-empty-project/llms.txt Creates a new user account with a specified role, intended for admin use. Allows user creation without email confirmation. Requires name, email, password, and role ID. Returns the newly created user's details. ```bash curl -X POST http://localhost/api/v0.1/users \ -H "Authorization: Bearer ADMIN_TOKEN..." \ -H "Content-Type: application/json" \ -d '{ "name": "Admin User", "email": "admin@example.com", "password": "AdminPass789", "role_id": 1 }' # Response: { "id": 3, "name": "Admin User", "email": "admin@example.com", "role_id": 1, "role": null } ``` -------------------------------- ### User Login API Request - Bash Source: https://context7.com/ronasit/laravel-empty-project/llms.txt Authenticates a user via email and password, returning a JWT token. The request includes user credentials and a 'remember' flag. The response contains the token, its validity periods, and user details. ```bash curl -X POST http://localhost/api/v0.1/login \ -H "Content-Type: application/json" \ -d '{ "email": "user@example.com", "password": "secretpassword", "remember": true }' # Response: { "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...", "ttl": 60, "refresh_ttl": 20160, "user": { "id": 1, "name": "John Doe", "email": "user@example.com", "role_id": 2, "role": { "id": 2, "name": "User" } } } ``` -------------------------------- ### POST /api/v0.1/register - User Registration Source: https://context7.com/ronasit/laravel-empty-project/llms.txt Creates a new user account and automatically logs them in, returning authentication credentials. Validates that the email is unique and that password confirmation matches. ```APIDOC ## POST /api/v0.1/register ### Description Creates a new user account and automatically logs them in, returning authentication credentials. Validates that the email is unique and that password confirmation matches. ### Method POST ### Endpoint /api/v0.1/register ### Parameters #### Query Parameters - **remember** (boolean) - Optional - Determines if the session should be remembered. #### Request Body - **name** (string) - Required - The user's full name. - **email** (string) - Required - The user's email address (must be unique). - **password** (string) - Required - The user's desired password. - **confirm** (string) - Required - The user's password confirmation. ### Request Example ```json { "name": "Jane Smith", "email": "jane@example.com", "password": "MySecurePass123", "confirm": "MySecurePass123", "remember": false } ``` ### Response #### Success Response (200) - **token** (string) - The JWT token for authentication. - **ttl** (integer) - The time-to-live for the token in minutes. - **refresh_ttl** (integer) - The time-to-live for the refresh token in minutes. - **user** (object) - The newly created user's details. - **id** (integer) - User's unique identifier. - **name** (string) - User's name. - **email** (string) - User's email address. - **role_id** (integer) - The ID of the user's role. - **role** (object) - Details of the user's role (can be null). #### Response Example ```json { "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...", "ttl": 60, "refresh_ttl": 20160, "user": { "id": 2, "name": "Jane Smith", "email": "jane@example.com", "role_id": 2, "role": null } } ``` ``` -------------------------------- ### Settings Management - Search Settings Source: https://context7.com/ronasit/laravel-empty-project/llms.txt Searches and filters settings with pagination. Returns only public settings for non-admin users, and all settings for admins. ```APIDOC ## GET /api/v0.1/settings ### Description Searches and filters settings with pagination. Returns only public settings for non-admin users, and all settings for admins. ### Method GET ### Endpoint `/api/v0.1/settings` #### Query Parameters - **query** (string) - Optional - The search query string. - **page** (integer) - Optional - The page number for pagination. Defaults to 1. - **per_page** (integer) - Optional - The number of items per page. Defaults to 10. - **order_by** (string) - Optional - The field to sort settings by (e.g., `name`). ### Response #### Success Response (200 OK) Returns a paginated list of settings. - **data** (array) - An array of setting objects. - **name** (string) - The name of the setting. - **value** (any) - The value of the setting. - **is_public** (boolean) - Indicates if the setting is publicly accessible. - **total** (integer) - The total number of settings found. - **per_page** (integer) - The number of settings per page. - **current_page** (integer) - The current page number. - **last_page** (integer) - The last page number. ### Response Example ```json { "data": [ { "name": "app_name", "value": { "title": "My Application", "version": "1.0.0" }, "is_public": true } ], "total": 1, "per_page": 10, "current_page": 1, "last_page": 1 } ``` ``` -------------------------------- ### Search and Filter Settings via API Source: https://context7.com/ronasit/laravel-empty-project/llms.txt Searches and filters settings with pagination capabilities. Non-admin users will only receive public settings, whereas administrators will see all settings. ```bash curl -X GET "http://localhost/api/v0.1/settings?query=app&page=1&per_page=10&order_by=name" \ -H "Authorization: Bearer TOKEN..." ``` -------------------------------- ### Restore Password API Request - Bash Source: https://context7.com/ronasit/laravel-empty-project/llms.txt Completes the password reset using a token received via email. Requires email, new password, password confirmation, and the reset token. Updates the password and invalidates the token. Returns 204 No Content. ```bash curl -X POST http://localhost/api/v0.1/auth/restore-password \ -H "Content-Type: application/json" \ -d '{ "email": "user@example.com", "password": "NewSecurePass456", "password_confirmation": "NewSecurePass456", "token": "abc123def456..." }' # Response: 204 No Content ``` -------------------------------- ### POST /api/v0.1/users - Create User Source: https://context7.com/ronasit/laravel-empty-project/llms.txt Creates a new user account with a specified role. This is an admin-only endpoint that allows the creation of users without requiring email confirmation. ```APIDOC ## POST /api/v0.1/users ### Description Creates a new user account with specified role. Admin-only endpoint that allows creation of users without requiring email confirmation. ### Method POST ### Endpoint /api/v0.1/users ### Parameters #### Header Parameters - **Authorization** (string) - Required - Bearer token for admin authentication (e.g., `Bearer ADMIN_TOKEN`). #### Request Body - **name** (string) - Required - The user's full name. - **email** (string) - Required - The user's email address. - **password** (string) - Required - The user's password. - **role_id** (integer) - Required - The ID of the role to assign to the user. ### Request Example ```json { "name": "Admin User", "email": "admin@example.com", "password": "AdminPass789", "role_id": 1 } ``` ### Response #### Success Response (200 or 201) - **id** (integer) - The newly created user's unique identifier. - **name** (string) - The user's name. - **email** (string) - The user's email address. - **role_id** (integer) - The ID of the user's role. - **role** (object) - Details of the user's role (can be null). #### Response Example ```json { "id": 3, "name": "Admin User", "email": "admin@example.com", "role_id": 1, "role": null } ``` ``` -------------------------------- ### Forgot Password API Request - Bash Source: https://context7.com/ronasit/laravel-empty-project/llms.txt Initiates the password reset process by sending a reset link to the user's email. Requires the user's email address. Returns 204 No Content for security, regardless of email existence. ```bash curl -X POST http://localhost/api/v0.1/auth/forgot-password \ -H "Content-Type: application/json" \ -d '{ "email": "user@example.com" }' # Response: 204 No Content ``` -------------------------------- ### POST /api/v0.1/login - User Login Source: https://context7.com/ronasit/laravel-empty-project/llms.txt Authenticates a user with email and password, returning a JWT token for subsequent API requests. The token is provided both in the response body and as an HTTP-only cookie. ```APIDOC ## POST /api/v0.1/login ### Description Authenticates a user with email and password, returning a JWT token for subsequent API requests. The token is provided both in the response body and as an HTTP-only cookie for browser-based applications. ### Method POST ### Endpoint /api/v0.1/login ### Parameters #### Query Parameters - **remember** (boolean) - Optional - Determines if the session should be remembered. #### Request Body - **email** (string) - Required - The user's email address. - **password** (string) - Required - The user's password. ### Request Example ```json { "email": "user@example.com", "password": "secretpassword", "remember": true } ``` ### Response #### Success Response (200) - **token** (string) - The JWT token for authentication. - **ttl** (integer) - The time-to-live for the token in minutes. - **refresh_ttl** (integer) - The time-to-live for the refresh token in minutes. - **user** (object) - The authenticated user's details. - **id** (integer) - User's unique identifier. - **name** (string) - User's name. - **email** (string) - User's email address. - **role_id** (integer) - The ID of the user's role. - **role** (object) - Details of the user's role (can be null). - **id** (integer) - Role's unique identifier. - **name** (string) - Role's name. #### Response Example ```json { "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...", "ttl": 60, "refresh_ttl": 20160, "user": { "id": 1, "name": "John Doe", "email": "user@example.com", "role_id": 2, "role": { "id": 2, "name": "User" } } } ``` ``` -------------------------------- ### Search and Filter Users via API Source: https://context7.com/ronasit/laravel-empty-project/llms.txt Searches for users with support for full-text search, role filtering, pagination, sorting, and eager loading of relationships. This endpoint is accessible only to administrators. ```bash curl -X GET "http://localhost/api/v0.1/users?query=john&role_id=2&page=1&per_page=20&with[]=role&order_by=name&desc=false" \ -H "Authorization: Bearer ADMIN_TOKEN..." ``` -------------------------------- ### User Service Methods - Laravel PHP Source: https://context7.com/ronasit/laravel-empty-project/llms.txt Demonstrates common operations for the UserService class in Laravel, including creating, searching, updating, finding (with relationships), deleting users, and initiating password reset flows. Requires the UserService and an active Laravel application context. ```php create([ 'name' => 'Test User', 'email' => 'test@example.com', 'password' => 'password123', 'role_id' => 2 ]); // Search users with filters $users = $userService->search([ 'query' => 'john', 'role_id' => 2, 'page' => 1, 'per_page' => 20, 'order_by' => 'name', 'desc' => false ]); // Update user $updatedUser = $userService->update(1, [ 'name' => 'Updated Name', 'password' => 'newpassword' // Auto-hashed ]); // Get user with relationships $user = $userService ->with(['role']) ->find(1); // Delete user $userService->delete(1); // Password reset flow $status = $userService->forgotPassword('user@example.com'); $resetStatus = $userService->restorePassword([ 'email' => 'user@example.com', 'password' => 'newpass', 'password_confirmation' => 'newpass', 'token' => 'reset_token' ]); ``` -------------------------------- ### User Logout API Request - Bash Source: https://context7.com/ronasit/laravel-empty-project/llms.txt Invalidates the current user session by expiring the authentication token. Requires the current token in the Authorization header. Returns a 204 No Content status on successful logout. ```bash curl -X POST http://localhost/api/v0.1/auth/logout \ -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9..." \ -H "Content-Type: application/json" # Response: 204 No Content ``` -------------------------------- ### User Profile - Delete Profile Source: https://context7.com/ronasit/laravel-empty-project/llms.txt Allows authenticated users to delete their own account. This action logs out the user and invalidates their token. ```APIDOC ## DELETE /api/v0.1/profile ### Description Allows authenticated users to delete their own account. This action logs out the user and invalidates their token. ### Method DELETE ### Endpoint `/api/v0.1/profile` ### Response #### Success Response (204 No Content) No content is returned upon successful deletion. ``` -------------------------------- ### Settings Management - Update Setting Source: https://context7.com/ronasit/laravel-empty-project/llms.txt Updates a setting's value by name. This is an admin-only endpoint that accepts arbitrary JSON data as the setting value. ```APIDOC ## PUT /api/v0.1/settings/{name} ### Description Updates a setting's value by name. This is an admin-only endpoint that accepts arbitrary JSON data as the setting value. ### Method PUT ### Endpoint `/api/v0.1/settings/{name}` #### Path Parameters - **name** (string) - Required - The name of the setting to update. #### Request Body - **value** (any) - Required - The new value for the setting. Can be any valid JSON data. ### Request Example ```json { "title": "Updated Application Name", "version": "2.0.0" } ``` ### Response #### Success Response (204 No Content) No content is returned upon successful update. ``` -------------------------------- ### Update Setting Value via API Source: https://context7.com/ronasit/laravel-empty-project/llms.txt Updates the value of a specific setting identified by its name. This is an administrator-only endpoint that supports arbitrary JSON data for the setting's value. ```bash curl -X PUT http://localhost/api/v0.1/settings/app_name \ -H "Authorization: Bearer ADMIN_TOKEN..." \ -H "Content-Type: application/json" \ -d '{ "title": "Updated Application Name", "version": "2.0.0" }' ``` -------------------------------- ### User Management - Search Users Source: https://context7.com/ronasit/laravel-empty-project/llms.txt Searches and filters users with pagination support. This is an admin-only endpoint that supports full-text search, role filtering, sorting, and eager loading of relationships. ```APIDOC ## GET /api/v0.1/users ### Description Searches and filters users with pagination support. This is an admin-only endpoint that supports full-text search, role filtering, sorting, and eager loading of relationships. ### Method GET ### Endpoint `/api/v0.1/users` #### Query Parameters - **query** (string) - Optional - The search query string. - **role_id** (integer) - Optional - Filters users by their role ID. - **page** (integer) - Optional - The page number for pagination. Defaults to 1. - **per_page** (integer) - Optional - The number of items per page. Defaults to 20. - **with[]** (string) - Optional - Specifies relationships to eager load (e.g., `role`). - **order_by** (string) - Optional - The field to sort users by (e.g., `name`). - **desc** (boolean) - Optional - Whether to sort in descending order. Defaults to `false`. ### Response #### Success Response (200 OK) Returns a paginated list of users. - **data** (array) - An array of user objects. - **id** (integer) - The user's ID. - **name** (string) - The user's name. - **email** (string) - The user's email. - **role_id** (integer) - The ID of the user's role. - **role** (object) - The user's role object (if `with[]=role` is included). - **id** (integer) - The role's ID. - **name** (string) - The role's name. - **total** (integer) - The total number of users found. - **per_page** (integer) - The number of users per page. - **current_page** (integer) - The current page number. - **last_page** (integer) - The last page number. ### Response Example ```json { "data": [ { "id": 1, "name": "John Doe", "email": "john@example.com", "role_id": 2, "role": { "id": 2, "name": "User" } } ], "total": 1, "per_page": 20, "current_page": 1, "last_page": 1 } ``` ``` -------------------------------- ### Update Authenticated User Profile via API Source: https://context7.com/ronasit/laravel-empty-project/llms.txt Allows authenticated users to update their own profile information, including their name, email, and password. The password will be automatically hashed upon update. ```bash curl -X PUT http://localhost/api/v0.1/profile \ -H "Authorization: Bearer TOKEN..." \ -H "Content-Type: application/json" \ -d '{ "name": "John Updated", "email": "johnupdated@example.com", "password": "NewPassword123" }' ``` -------------------------------- ### POST /api/v0.1/auth/restore-password - Restore Password Source: https://context7.com/ronasit/laravel-empty-project/llms.txt Completes the password reset process using the token received via email. Updates the user's password and invalidates the reset token. ```APIDOC ## POST /api/v0.1/auth/restore-password ### Description Completes the password reset process using the token received via email. Updates the user's password and invalidates the reset token. ### Method POST ### Endpoint /api/v0.1/auth/restore-password ### Parameters #### Request Body - **email** (string) - Required - The user's email address. - **password** (string) - Required - The new password for the user. - **password_confirmation** (string) - Required - The confirmation of the new password. - **token** (string) - Required - The password reset token received via email. ### Request Example ```json { "email": "user@example.com", "password": "NewSecurePass456", "password_confirmation": "NewSecurePass456", "token": "abc123def456..." } ``` ### Response #### Success Response (204) No Content ``` -------------------------------- ### POST /api/v0.1/auth/forgot-password - Forgot Password Source: https://context7.com/ronasit/laravel-empty-project/llms.txt Initiates a password reset flow by sending a reset link to the user's email address. Returns 204 No Content regardless of whether the email exists. ```APIDOC ## POST /api/v0.1/auth/forgot-password ### Description Initiates a password reset flow by sending a reset link to the user's email address. Returns 204 No Content regardless of whether the email exists (security best practice). ### Method POST ### Endpoint /api/v0.1/auth/forgot-password ### Parameters #### Request Body - **email** (string) - Required - The user's email address. ### Request Example ```json { "email": "user@example.com" } ``` ### Response #### Success Response (204) No Content ``` -------------------------------- ### User Profile - Update Profile Source: https://context7.com/ronasit/laravel-empty-project/llms.txt Updates the authenticated user's own profile information. Users can update their name, email, and password. ```APIDOC ## PUT /api/v0.1/profile ### Description Updates the authenticated user's own profile information. Users can update their name, email, and password. ### Method PUT ### Endpoint `/api/v0.1/profile` #### Request Body - **name** (string) - Optional - The updated name of the user. - **email** (string) - Optional - The updated email of the user. - **password** (string) - Optional - The updated password for the user. ### Request Example ```json { "name": "John Updated", "email": "johnupdated@example.com", "password": "NewPassword123" } ``` ### Response #### Success Response (204 No Content) No content is returned upon successful update. ``` -------------------------------- ### POST /api/v0.1/auth/logout - User Logout Source: https://context7.com/ronasit/laravel-empty-project/llms.txt Invalidates the current user session by expiring the authentication token cookie. Returns 204 No Content on success. ```APIDOC ## POST /api/v0.1/auth/logout ### Description Invalidates the current user session by expiring the authentication token cookie. Returns 204 No Content on success. ### Method POST ### Endpoint /api/v0.1/auth/logout ### Parameters #### Header Parameters - **Authorization** (string) - Required - Bearer token for authentication (e.g., `Bearer YOUR_TOKEN`). ### Request Example ```bash curl -X POST http://localhost/api/v0.1/auth/logout \ -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9..." \ -H "Content-Type: application/json" ``` ### Response #### Success Response (204) No Content ``` -------------------------------- ### Update User Information via API Source: https://context7.com/ronasit/laravel-empty-project/llms.txt Updates user details such as name and email. This endpoint is restricted to administrators. If a password is included in the request, it will be automatically hashed. ```bash curl -X PUT http://localhost/api/v0.1/users/3 \ -H "Authorization: Bearer ADMIN_TOKEN..." \ -H "Content-Type: application/json" \ -d '{ "name": "Updated Admin Name", "email": "newemail@example.com" }' ``` -------------------------------- ### Delete Authenticated User Profile via API Source: https://context7.com/ronasit/laravel-empty-project/llms.txt Enables authenticated users to delete their own account. This action logs the user out and invalidates their current session token. ```bash curl -X DELETE http://localhost/api/v0.1/profile \ -H "Authorization: Bearer TOKEN..." ``` -------------------------------- ### Delete User Account via API Source: https://context7.com/ronasit/laravel-empty-project/llms.txt Permanently removes a user account from the system. This is an administrator-only endpoint that performs a hard delete of the user record from the database. ```bash curl -X DELETE http://localhost/api/v0.1/users/3 \ -H "Authorization: Bearer ADMIN_TOKEN..." ``` -------------------------------- ### User Management - Delete User Source: https://context7.com/ronasit/laravel-empty-project/llms.txt Permanently deletes a user account. This is an admin-only endpoint that removes the user from the database. ```APIDOC ## DELETE /api/v0.1/users/{id} ### Description Permanently deletes a user account. This is an admin-only endpoint that removes the user from the database. ### Method DELETE ### Endpoint `/api/v0.1/users/{id}` #### Path Parameters - **id** (integer) - Required - The ID of the user to delete. ### Response #### Success Response (204 No Content) No content is returned upon successful deletion. ``` -------------------------------- ### User Management - Update User Source: https://context7.com/ronasit/laravel-empty-project/llms.txt Updates user information by ID. This is an admin-only endpoint. If a password is provided in the request, it will be automatically hashed. ```APIDOC ## PUT /api/v0.1/users/{id} ### Description Updates user information by ID. This is an admin-only endpoint. If a password is provided in the request, it will be automatically hashed. ### Method PUT ### Endpoint `/api/v0.1/users/{id}` #### Path Parameters - **id** (integer) - Required - The ID of the user to update. #### Request Body - **name** (string) - Optional - The updated name of the user. - **email** (string) - Optional - The updated email of the user. - **password** (string) - Optional - The updated password for the user. Will be hashed automatically. ### Request Example ```json { "name": "Updated Admin Name", "email": "newemail@example.com" } ``` ### Response #### Success Response (204 No Content) No content is returned upon successful update. ``` -------------------------------- ### Token Refresh API Request - Bash Source: https://context7.com/ronasit/laravel-empty-project/llms.txt Refreshes an expired JWT token without requiring re-authentication. Requires the current token in the Authorization header. The response provides a new token and its validity details. ```bash curl -X GET http://localhost/api/v0.1/auth/refresh \ -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9..." \ -H "Content-Type: application/json" \ -d '{ "remember": true }' # Response: { "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.NEW_TOKEN...", "ttl": 60, "refresh_ttl": 20160 } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.