I am using laravel. Below is my form.
<h1>New Comment</h1>
<form method="post">
Comment: <input type="text" size="128" name="comment" value="{{old('body')}}" /></p>
@if ($errors->has('body'))
<p class="warning">Comment cannot be empty.</p>
@endif
<p><input type="submit" value="Submit" /> <input type="reset" value="Reset" /></p>
{{ csrf_field() }}
</form>
My Route:
Route::post('/{id}', 'FilmsController@addComment')->name('addComment');
My controller:
public function addComment(Request $request)
{
$request->validate([
'body' => 'required',
]);
$entry = new Comment();
$entry->body = $request->body;
$entry->save();
return redirect('/');
My schema includes 'body'... $table->string('body');
I am seeing my warning message when I click submit. The same happens when trying to update as well as add a new comment.