I am trying to send a request to my PHP Laravel API that would store as “content” both files and text, however when i send the POST request, only the file path gets saved in the database and the request returns an array that is empty, is the problem from postman or my API?
Here is the code for my post:
public function store(Request $request) { $request->validate([ 'content' => 'required|max:255', 'user_id' => 'required|exists:users,id', 'item_id' => 'required|exists:items,id' ]); return Comment::create($request->all()); }
Advertisement
Answer
Try With change content to content[file]
and content[text]
this is work for me