You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a model called Recipe which links to a model called BjcpStyle.
The relationship looks like this:
public function bjcpStyle()
{
return $this->belongsTo(BjcpStyle::class, 'bjcp_style_id', 'sub_category_id');
}
I only want to select sub_category_id and name from the BjcpStyle model.
So I drummed up a query like this; /recipes?include=bjcp-style&fields[bjcp-style]=sub_category_id,name
However this returns all fields for the BjcpStyle model.
Other URLs I have tried:
/recipes?include=bjcp-style&fields[bjcp_styles]=sub_category_id,name (the table name itself)
/recipes?include=bjcp-style&fields[bjcpStyle]=sub_category_id,name (the name of the actual relationship)
However neither of these work.
I did some very basic debugging by chucking a bunch of dump() statements in the QueryBuilder file to see what was coming through and it looks like it is picking up that I have specified bjcp-style as a field in the request, but when parsing the table name and fields, I do not see any processing for this.
Am I doing something wrong in the request above, or is there an issue here?
The text was updated successfully, but these errors were encountered:
This might be the same issue as #118. A fix for that was tagged a couple of minutes ago in 1.11.2. Can you check if the issue is still there in that version? Thanks.
I have a model called
Recipe
which links to a model calledBjcpStyle
.The relationship looks like this:
I only want to select
sub_category_id
andname
from theBjcpStyle
model.So I drummed up a query like this;
/recipes?include=bjcp-style&fields[bjcp-style]=sub_category_id,name
However this returns all fields for the
BjcpStyle
model.Other URLs I have tried:
/recipes?include=bjcp-style&fields[bjcp_styles]=sub_category_id,name
(the table name itself)/recipes?include=bjcp-style&fields[bjcpStyle]=sub_category_id,name
(the name of the actual relationship)However neither of these work.
I did some very basic debugging by chucking a bunch of
dump()
statements in theQueryBuilder
file to see what was coming through and it looks like it is picking up that I have specifiedbjcp-style
as a field in the request, but when parsing the table name and fields, I do not see any processing for this.Am I doing something wrong in the request above, or is there an issue here?
The text was updated successfully, but these errors were encountered: