监听数据库查询语句
时间:2021-07-01 10:21:17
帮助过:56人阅读
use Illuminate\Support\ServiceProvider;
use Validator;
class AppServiceProvider
extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
// validator extend phone
Validator::extend(‘phone‘,
function (
$attribute,
$value,
$parameters) {
if (
preg_match(‘/^170/‘,
$value)) {
return false;
}
if (
preg_match(‘/^1(3[0-9]|4[0-9]|5[012356789]|8[01256789]|7[0678])\d{8}$/‘,
$value)) {
return true;
}
return false;
}, ‘手机号不正确‘
);
// \DB::listen(function($query) {
// \Log::info($query->sql);
// });
}
监听数据库查询语句
标签:param 数据库 one als support cti ida class service