Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Hala's avatar
Level 3

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'
    ]);
}
0 likes
2 replies
bobbybouwmann's avatar
Level 88

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

1 like
Hala's avatar
Level 3

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.