Please show some code?
Aug 17, 2020
7
Level 1
How to fetch data through relationships between models using api
I am creating a mobile app with react native as the front end and using laravel to create API which I can use to connect with my backend. I am trying to fetch data using relationships between the different models in my database but I keep getting the error (Call to a member function get() on null). Pls anyone have any idea on how I can solve this
Level 102
You need to use the right name
$maths = User::find($id)->mathematics
But I have a feeling your error is in some code that isn't shown
Please or to participate in this conversation.