0

I keep on getting this error:

(message "Array to string conversion" exception "ErrorException")

This is my controller

public function IssueItem(Request $request) {
    $item_issued = new Issue();
    $item_issued->username = $request->input('name');
    $item_issued->quantity = $request->input('quantity');
    $item_issued->nric = $request->input('nric');
    $item_issued->reason = $request->input('Reason');
    $item_issued->remarks = $request->input('Remarks');
    $item_issued->inventoryid= $request->input('inventoryid');
    $item_issued->date= $request->input('date');
    return response()->json($item_issued->save());   
}
}
Kirk Beard
  • 9,569
  • 12
  • 43
  • 47
  • Because one of your input is array. Try dd($request->all()) to check it – Khang Tran Apr 13 '23 at 06:27
  • 1
    Does this answer your question? [Reference - What does this error mean in PHP?](https://stackoverflow.com/questions/12769982/reference-what-does-this-error-mean-in-php) – Kirk Beard Apr 13 '23 at 06:39
  • This [answer](https://stackoverflow.com/a/24507107) helps to explain the cause. One (or more) of the input fields in your code is an array, which causes the error. If you can [edit] your question to include the code from your `
    `, others will be able to give you a more specific explanation of how to fix the issue.
    – Kirk Beard Apr 13 '23 at 06:41

0 Answers0