Calling a member function () function on an object without an object in the Lumen API

I got this error in my Lumen API update module. I did not receive the Request $request value from the postman. This only happens in my UserController , my other controllers are working fine. I use the put method to update the user.

This is mistake:

FatalErrorException in Request.php 901 line: calling a member function Parameter () for a non-object in the Lumen API

My update function looks like this:

 public function updateUser(Request $request,$user_id) { try { $user = User::findOrFail($user_id); } catch(ModelNotFoundException $e) { return "User not found"; } $user->buyer_id = $request->buyer_id; 
+5
source share
1 answer

The fact is that Lumen and Laravel use different route determinants. You yourself can see this if you simply enter the type of the variable $route immediately before this line 901.

Try $request['buyer_id'] .

+8
source

All Articles