Skip to content

Table field name method results ignoring fields in the selector when called inside hook #2152

@adrianbj

Description

@adrianbj

I have so far tested this with the User::changed hook (shown below), but also with Pages::saveReady so it seems to be universal with hooks

$wire->addHookAfter('User::changed(refund_test)', function($event) {
    $u = $event->object;
    bd($u->subscriptions('amount_paid>0, limit=1, sort=-date')->last());
});

will return the last row of the table, completing ignoring the amount_paid>0 condition.

However, this (using in-memory find on the table) works as expected:

$wire->addHookAfter('User::changed(refund_test)', function($event) {
    $u = $event->object;
    bd($u->subscriptions->find('amount_paid>0, limit=1, sort=-date')->last());
});

Outside of a hook, the method approach works as expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions