I need to know the user_id (the required parameters) because user_id would be the user who "receives" the friend request and the same with the user response to that request.
So, to do that, I need to do
$friend_request->notification($user_id)->first();
// OR
$request->notification()->whereUserId($user_id); // I think this would be the right way and pass a Closure when eager load
@luddinus You can create parametrized method that will return closure used in eager loading.
public static function getSomeClosure($param) // might be static or instance method
{
return function ($query) use ($param) {
$query->where('column', $param);
};
}