1.增
$data = [ 'username' => 'xiaohong', 'nickname' => '小红红', 'email' => '12356788@qq.com', 'phone' => '13554321234', 'password' => md5('123456'), 'login_status'=> 1, ]; $res=DB::table('admins')->insertGetId($data);
2.删
$res=DB::table('admins')->whereIn('id',[10,11])->delete();
3.改
$data = [ 'nickname'=> '超级管理员', 'email' => 'itheima@qq.com', ]; $res = DB::table('admins')->where('username','=','root')->update($data);
4.查
$where=[ ['id','>',5], ['id','<',10], ]; $res=DB::table('admins')->where('nickname');