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;
        }
    }

 

上一篇:SAP UI5 StandardListItem和ObjectListItem的区别


下一篇:Laravel基于PHP Monolog打造一个API日志记录器