Skip to content

Controller hooks for modifying relationships should receive the relation value #17

Closed
@lindyhopchris

Description

@lindyhopchris

As per this issue:
cloudcreativity/laravel-json-api#264

The controller hooks for modifying a relation should receive the relation value. We can use the LazyRelation value here, just like the authorizers.

The LazyRelation class actually caches its value internally for a to-many relation. We should add caching of the to-one relation as well. Then we should keep the instance on the request, so that the same instance is used for both the authorization and the controller hooks: meaning there would only be one database request if the relation is accessed in both the authorization code and the controller hook.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions