laravel中model查询数据

   public function selectById(Request $request){
         $id = $request->get("id");
         $result = Test::find($id)->toArray();
        // 查询满足条件的一批数据
         $result1 = Test::where("id",">","11806943")->where("name","like","%"."马"."%")->get();
         
        // 查询满足条件的第一条数据
        $result1 = Test::where("id",">","11806943")->where("name","like","%"."马"."%")->first();
        foreach ($result1 as $key1 => $value1){
            echo $value1;
        }
    }

 

相关文章

laravel的dd函数不生效怎么办
看不懂laravel文档咋办
安装laravel框架出现command怎么办
Laravel开发API怎么使用事务
laravel怎么构建复杂查询条件
laravel如何实现防止被下载