this is method in UserRepository file:
public function update($request, $id)
{
$new_request = (object)$request;
$data = $new_request->all();
$this->user::where('id', $id)->update($data);
return http_response_code(201);
}
this is method in UserController:
public function update(UpdateUserRequest $request, $id)
{
return $this->userRepository->update($request, $id);
}
this is UpdateUserRequest:
'username' => 'required|string',Rule::unique('users')->ignore($this->user),
but don't work and my error is: Attempt to read property "id" on string
Aucun commentaire:
Enregistrer un commentaire