I get this error. msg Call the addEagerConstraints () member function for a non-object when I try to call a function from my model. Here is the function:
public static function checkClaimById($claim_id) {
$result = Claim::with('orders')
->find($claim_id)
->where('orders.user_id', Auth::user()->id)
->whereNull('deleted_at')
->count();
if($result >= 1) {
return true;
} else {
return false;
}
}
I have a “complaint” about a model that has an order_id field and it belongs to order. And I have a model of "order", and one Order has many complaints.
Can someone help me?
Thanks Relations
source
share