michapietsch
4 months ago

Eagerly loaded relation not present in view

Posted 4 months ago by michapietsch

Hi,

I load a model with with and first and in an immediate dump the related data is present, but in the data passed to the view it's missing.

I create a demo here: github.com/michapietsch/laravel-eager-loading-missing-in-view-example

See how in routes.web I use Flight::with('passengers')->first() and uncomment the dump to verify that the passengers are present there. In the ExampleTest I check for the data to be present and it's missing.

Am I missing something here?

Please sign in or create an account to participate in this conversation.