Replies: 4 comments
-
Hi @vesavlad, Perhaps just put a condition inside the protected function alwaysIncludes(): array
{
if (Route::current()->named('<name of the route that always includes relations>')) {
return ['points'];
}
return [];
} |
Beta Was this translation helpful? Give feedback.
-
Maybe |
Beta Was this translation helpful? Give feedback.
-
well, would say that indeed would make sense for orion to have something like this available: protected function alwaysIncludes(): array
{
return [
'points' => IncludesOption::showOnIndex | IncludesOption::showOnDetail,
'other' => IncludesOption::showOnIndex ,
'parent',
'child' => IncludesOption::showOnDetail,
];
} Where IncludesOptions: final class IncludesOptions
{
const showOnIndex = 1;
const showOnDetail = 2;
const showOnUpdate = 4;
const showOnDelete = 8;
} Where in case no config is specified we the include will be available for both. This option can be used also for In this way:
|
Beta Was this translation helpful? Give feedback.
-
Hmm, I do see some benefits of making whitelisting more granular, but at the same time it feels like covering of edge cases 🤔 I will leave the issue open - lets see, if there are more developers that encounter this situation. In the meantime, I will check what are the possible solutions for this. |
Beta Was this translation helpful? Give feedback.
-
I have an api for providing localization information and shaping data. In this case I don't want to always include points for a shape for example when doing the regular "index" call but I want them to always be included when doing the "detail" call to get one shape.
Ex:
/api/v1/shapes
should not include the points cause this generates allot of data that not all is useful for the client/api/v1/shapes/1
should include the points that are in the shape.Can I achieve the following use-case without
?includes=points
? As mentioned I want them the always be included and not leave this client.Plugin version: 2.1.3
Laravel version: 8.49.2
Beta Was this translation helpful? Give feedback.
All reactions