Laravel没有将所有数据插入DB

Leo*_*ent 3 php mysql database blogs laravel

我正在编写评论部分; 我从下面的表格中获取用户数据:

<div class="comment">
    <h2>Leave a comment</h2>
    <form method="post" action="/blog/{{$post->id}}/comments">
    {{csrf_field()}}

     <input type="text" name= "name" class="textbox" value="Name" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Name';}">
     <input type="text" name="email" class="textbox" value="Email" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Email';}">
     <textarea value="Message:" name="body" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Message';}">Message</textarea>

     <div class="smt1">
        <input type="submit" value="add a comment">
     </div>
   </form>
</div>
Run Code Online (Sandbox Code Playgroud)

我通过如下的CommentsController存储方法获取路径上的数据:

Route::post('/blog/{post}/comments','CommentsController@store');
Run Code Online (Sandbox Code Playgroud)

然后通过控制器的方法将它们存储在db上:`

    public function store(Post $post){


    Comment::create([
       'body'    => request('body'),
       'email' =>request('email'),
       'name' =>request('name'),
       'post_id' => $post->id
    ]);


    return back();
}
Run Code Online (Sandbox Code Playgroud)

问题是,当我进入数据库时​​,身体字段插入完全正常,但post_id,名称,电子邮件他们没有插入数据库,他们是空的.

我已签,如果我从我所做的形式获取数据die; dump dd();name,email$post->id我得到的数据从形式上完全好,但我不能让他们插在数据库上?

Sen*_*ray 6

post_id,name和email列是否在评论模型中受保护的$ fillable数组中列出?如果它们未列为可填写,则不会输入.