为了账号安全,请及时绑定邮箱和手机立即绑定

sqlstate 42s22 列未找到“字段列表”中的 1054 未知列

sqlstate 42s22 列未找到“字段列表”中的 1054 未知列

PHP
达令说 2021-07-06 16:55:57
伙伴们,我收到错误sqlstate 42s22 columnactivity_post_commentsnot found 1054 unknown column in 'field list'但是这个列名存在于我的数据库中。我检查了我的数据库并检查了拼写错误,但我仍然收到此错误public function storecomments(Request $request, $id){    // Create Comment    $activity_post = new ActivityPost;    $activity_post->activity_post_comments = $request->input('activity_post_comments');    $activity_post->activity_post_id = $id;    $activity_post->user_id = auth()->user()->id;    $activity_post->save();    return redirect()->back()->with('success', 'Comment Added');}不知道为什么我收到这个错误所以我不能在我的数据库中保存这个值模型:class ActivityPostComment extends Model{  use SoftDeletes;    // Table Name    protected $table = 'activity_post_comments';    // Primary Key    public $primaryKey = 'id';    // Timestamps    public $timestamps = true;    /**     * The attributes that should be mutated to dates.     *     * @var array     */    protected $dates = ['deleted_at'];    public function post(){        return $this->belongsTo('App\ActivityPost');    }}
查看完整描述

1 回答

?
缥缈止盈

TA贡献2041条经验 获得超4个赞

根据您发布的上述代码。你调用错误的模型你的模型类名称是

活动帖子评论

当你使用

活动贴


查看完整回答
反对 回复 2021-07-16
  • 1 回答
  • 0 关注
  • 372 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信