Laravellaravel 数据库的事务操作 +打印sql事务操作 DB::beginTransaction(); try { DB::insert(...); DB::insert(...); DB::insert(...); DB::commit(); // all good } catch (\Exception $e) { DB::rollback(); // something went wrong }作者王明昌发布时间2020-05-10最后更新2020-05-10复制事务操作 DB::beginTransaction(); try { DB::insert(...); DB::insert(...); DB::insert(...); DB::commit(); // all good } catch (\Exception $e) { DB::rollback(); // something went wrong } 打印sql // DB::connection()->enableQueryLog();#开启执行日志 $r_parm = objectToArrayLaravel(Db::table('product_sku_info_parm')->select('info_id',DB::raw('count(id) as sumii')) ->where($where) ->where(function ($query) use ($orWhere) { $query->orWhere($orWhere); }) ->orderBy("sumii","desc") ->groupBy('info_id')->first()); // print_r(DB::getQueryLog());
2019-01-10laravel多条件排序$goods = Goods::orderBy('created_at','desc')->orderBy('id','desc')->paginate(6);
2018-03-11laravel开发博客遇到的问题(一)1.引入css,js,img等最好使用asset 使用此方式,获取的是带域名的绝对路径 2.测试数据库是否连接正常数据库 use DB; $pdo = DB::connection()->getPdo
2019-01-12laravel 使用生成二维码扩展composer require simplesoftwareio/simple-qrcode 1.5.1 // 在config/app.php 注册服务提供者: SimpleSoftwareIO\Q
2019-02-09laravel新建应用报错:The Process class relies on proc_open, which is not#laravel new blog Crafting application... [Symfony\Component\Process\Exception\RuntimeException] The
2020-01-01laravel 使用 Editor.md关于图片上传csrf的处理 大家都知道laravel默认提交表单时是启用csrf验证的 那么关于Editor.md关于图片上传csrf的处理有两个 1. 关闭csrf验证  加入csrf验证 上传方法:  视图: 加入t
2019-01-12laravel migration 中integer方法无法指定长度查看源代码后发现integer方法的第二个参数并不是指定长度,而是是否设置auto increment, 所以integer方法无法指定子段长度,默认为11。