laravel-query-builder
laravel-query-builder copied to clipboard
feat: Automatically include 'id' field in related table queries
(this may be also related to issue #959
Automatically Include 'id' Field in Related Table Queries
Description
This PR modifies the getRequestedFieldsForRelatedTable
method to automatically include the 'id' field when querying related tables. This enhancement improves user experience by reducing the need for redundant specifications in API requests.
Motivation and Context
When working with related tables, the 'id' field is often crucial for maintaining relationships and performing subsequent operations. However, requiring users to explicitly include 'id' in every request (e.g., fields[carModel]=slug,id
) can be cumbersome and error-prone. This change aims to streamline the API usage while ensuring that essential data is always available.