使用laravel 的数据库Facade 可以比较好的 执行数据库sql
$array = DB::select("select * from admin_users");
//raw 执行sql
$object = DB::table("admin_users")->where("id","=","1")->first();
//获取查询第一条
$array = DB::table("admin_users")->where("id","=","1")->get();
//
get获取数据列表
$array = DB::table("admin_users")->where("id","=","1")->skip(0)->take(1)->get();
//分页查询
$array = DB::table("admin_users")->where("id","=","1")->skip(0)->limit(1)->get();
//分页查询
DB::transaction(function (){
//内部执行开启事务
});
//手动控制事务
DB::beginTransaction();
DB::commit();
DB::rollBack();