laravel-query-builder icon indicating copy to clipboard operation
laravel-query-builder copied to clipboard

feat: Automatically include 'id' field in related table queries

Open inmass opened this issue 5 months ago • 1 comments

(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.

inmass avatar Sep 23 '24 14:09 inmass