Closed kfoon closed 2 years ago
Can you please provide more details? Could you please also use the reporting an issue template?
There are also not that many lines in that file.
Have you customised the controller constructor and/or restfulservice in some way?
Yes i have a constructor on my controller:
class UserController extends ApiController { public static $model = User::class;
/**
* @var UserRepository
*/
private $users;
/**
* UsersController constructor.
* @param UserRepository $users
*/
public function __construct(UserRepository $users)
{
$this->users = $users;
}
.......
So if you have a look at the RestfulController, you'll see it's constructor already takes one parameter.
You can add more parameters to your own controller, but you still need to be compatible - so do what the restful controller does and pass the first parameter to the parent controller. If you use an IDE, it should make this error clear, as essentially you are not using PHP inheritance correctly.
For example, in your case, you would need to do;
public function __construct(RestfulService $restfulService, UserRepository $users)
{
parent::__construct($restfulService);
$this->users = $users;
}
"message": "Call to a member function validateResourceUpdate() on null", "statusCode": 500, "debug": { "line": 256, "file": "/var/www/html/funi-api-vi/vendor/specialtactics/l5-api/src/Http/Controllers/RestfulController.php", "class": "Error",
but the $request->input() and $model all has data