Answer the question
In order to leave comments, you need to log in
Why are the last two values not written to the database?
Hello Laravel site
In controller
app/Http/Controllers/Api/ProductCommentsController.php
public function store(Request $request)
{
$new_comment = [
'product_slug' => $request->get('productSlug'),
'product_id' => $request->get('productID'),
'user_id' => $request->get('userID'),
'content' => $request->get('content'),
'user_name' => $request->get('userName'),
'user_mail' => $request->get('userEmail'),
];
$comment = new ProductComments($new_comment);
$comment->save();
return response()->json($new_comment);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question