Having read this SO link,
PUT
is most-often utilized for update capabilities, PUT-ing to a known resource URI with the request body containing the newly-updated representation of the original resource.
... we need to send all the parameters of the data again.
In my controller, I have:
$student = Student::find($student_id);
$student->username = $request->username;
$student->email = $request->email;
$student->password = $request->password;
$path = $request->file('passport')->store('upload');
$student->passport = $path;
I have once used this same code for POST
method and it worked, but while using it for APIs, I used POSTMAN form-data
and got $request->all()
to be null
. Some said I should use x-www-form-urlencoded
but this does not allow files upload.