buildadmin/app/common/middleware/AdminLog.php

19 lines
429 B
PHP
Raw Normal View History

2022-03-22 15:37:38 +00:00
<?php
namespace app\common\middleware;
2022-08-23 16:27:21 +00:00
use Closure;
2022-03-22 15:37:38 +00:00
use think\facade\Config;
use app\admin\model\AdminLog as AdminLogModel;
class AdminLog
{
2022-08-23 16:27:21 +00:00
public function handle($request, Closure $next)
2022-03-22 15:37:38 +00:00
{
$response = $next($request);
2022-03-22 19:21:42 +00:00
if (($request->isPost() || $request->isDelete()) && Config::get('buildadmin.auto_write_admin_log')) {
2022-03-22 15:37:38 +00:00
AdminLogModel::record();
}
return $response;
}
}