I am struggling to make an API call to my project. Can someone assist me here? This is the command I am entering:
curl.exe -X PUT http://hsk.local/api/v1/applicants/1 \ -H "Content-Type: application/json" \ -d '{"status_id": "2"}'
And this is the logic:
public function update(Request $request, Applicant $applicant)
{
if ($request->status_id == 2)
{
$password = Str::password();
//todo: logic to send this new password via email
return User::class->create([
'profile_id' => $applicant->profile_id,
'password' => $password,
]);
}
elseif ($request->status_id == 3)
{
$applicant->delete();
//todo: add some better return than this...
return 'deleted...';
} else
{
$applicant->update([
'status_id' => $request->status_id
]);
return ApplicantResource::make($applicant->load(['profile', 'status']));
}
}
I tried dumping all the request and I get an empty JSON back. So it seems like the data is never actually received.