Привет при попытки оставить комментарий на сайте выдают такую ошибку
Illuminate \ Database \ QueryException (HY000)
SQLSTATE[HY000]: General error: 1364 Field 'id' doesn't have a default value (SQL: insert into `comments` (`name`, `text`, `post_id`, `updated_at`, `created_at`) values (Тест, Привет, 1, 2019-04-22 12:08:26, 2019-04-22 12:08:26))
Previous exceptions
SQLSTATE[HY000]: General error: 1364 Field 'id' doesn't have a default value (HY000)
"SQLSTATE[HY000]: General error: 1364 Field 'id' doesn't have a default value (SQL: insert into `comments` (`name`, `text`, `post_id`, `updated_at`, `created_at`) values (Тест, Привет, 1, 2019-04-22 12:08:26, 2019-04-22 12:08:26))
Вот модель коментария
namespace App;
use Illuminate\Database\Eloquent\Model;
class Comment extends Model
{
protected $fillable = ['id', 'name', 'text', 'post_id', 'status'];
public function post()
{
return $this->belongsTo('App\Post');
}
}
Вот код контролера
public function comment(Request $request)
{
$this->validate($request,[
'name' => 'required',
'text' => 'required',
]);
Comment::create([
'name' => $request->name,
'text' => $request->text,
'post_id' => $request->post_id,
]);
return redirect()->back()->with('status', 'Комментарий добавлен');
}