laravel用like查询报错

我是按照官网的例子写的
"message": "SQLSTATE[42S22]: Column not found: 1054 Unknown column '0' in 'where clause' (SQL: select * from `blog` where (`0` = content and `1` = like and `2` = %333%))",

        $keyword=$request->input('content');
        if(!empty($keyword)){
            $res=Blog::where(['content','like',"%{$keyword}%"])->get();
            return $res;
        }
阅读 1.8k
1 个回答

Blog::where('content','like',"%{$keyword}%")->get();

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进