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
Hi,
I am currently trying this package.
But have a tough time i tried to stick to the docs but i cannot get it to work.
I have a data class, with a relation in it:
#[FromRouteParameter('someModel')]
#[DataCollectionOf(PageData::class)]
#[AutoLazy]
#[LoadRelation('pages')]
public Lazy|array $pages,
i want it only loaded if the parameter is included so:
The issue i have now is that it does not return a collection of PageData but the complete eloquent models. (for that i have to change the type to mixed, otherwise i just get a 422 validation error).
I also tried without autolazy doing that myself in fromModel but the fromModel method is not even called.
May i am using it entirely wrong, any advice how to archive my goal?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I am currently trying this package.
But have a tough time i tried to stick to the docs but i cannot get it to work.
I have a data class, with a relation in it:
i want it only loaded if the parameter is included so:
Controller:
Route:
Route::get('/someModel/{someModel}', [ModelController::class, 'getContent']);
Request:
$this->getJson("/api/v1/someModel/{$someModel->id}?include=pages")
The issue i have now is that it does not return a collection of PageData but the complete eloquent models. (for that i have to change the type to mixed, otherwise i just get a 422 validation error).
I also tried without autolazy doing that myself in
fromModel
but the fromModel method is not even called.May i am using it entirely wrong, any advice how to archive my goal?
Beta Was this translation helpful? Give feedback.
All reactions