Why I’m getting ‘Non-static method should not be called statically’ when invoking a method in a Eloquent model?
I don’t know why I am getting this error:
Non-static method App\Userevent::returnopretor() should not be called statically
This is my blade file method:
This is my model:
Can you help me? I am trying to do dynamic dependency dropdown menu in view with this. Want to get user names and id from Userevent model for dropdown in view and than connect returnopretor with users and save data to product table with user id.
Relationships is to be called on models, so you have to fetch them from a user model. Change your controller logic to just fetch Userevent, not anything with returnopretor.
So in your blade file where you create your drop down, loop the users and then you can loop the returnopretor.
solved this error.