Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resource whenPivotLoaded not showing relation #14

Open
BaeleMarco opened this issue Jul 25, 2024 · 0 comments
Open

Resource whenPivotLoaded not showing relation #14

BaeleMarco opened this issue Jul 25, 2024 · 0 comments

Comments

@BaeleMarco
Copy link

How can I add this relation to my resource to only show it when it's loaded?

I have this pivot between Module And File with an added language_id to this pivot

'pivot' => $this->whenPivotLoaded('module_file', fn () => [
    'sequence'      => $this->pivot->sequence,
    'language_id'   => $this->pivot->language_id,
    'language_code' => $this->whenLoaded('language', $this->pivot->language->code), // Doesn't show
    'language_code' => $this->pivot->whenLoaded('language', $this->pivot->language->code), // Error
    'language_code' => $this->whenPivotLoaded('language', $this->pivot->language->code), // Doesn't show
]),

The Language relation doesnt even show when I just use

'pivot' => $this->whenPivotLoaded('module_file', $this->pivot),
'pivot' => $this->whenPivotLoaded('module_file', fn () => $this->pivot),

How would this work?

@BaeleMarco BaeleMarco changed the title resource whenPivotLoaded Resource whenPivotLoaded not showing Jul 25, 2024
@BaeleMarco BaeleMarco changed the title Resource whenPivotLoaded not showing Resource whenPivotLoaded not showing relation Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant