Nova tool ,doesn't added data in database
Hello i have a nova tool when i make anova request to post data , the data have been received successfully ,
but the database not save it
here is my Controller method
public function comment(Request $request)
{
Validator::make($request->all(), [
'body' => 'required',
'post_id' => 'required',
])->validate();
Comment::create([
'user_id' => User::inRandomOrder()->first()->id,
'post_id' => $request->post_id,
'body' => $request->body
]);
return responder()->success([
'status' => 'success'
]);
}
I don't think the problem is in the Nova tool itself. Did make the fields fillable or removed them from guarded in your Comment model?
Also, does the validation pass? You can try it with a log statement to see where you get passed
Thank you , yes everything was correct , i figure out my problem i just order my data database in ASC :)
Please or to participate in this conversation.