本文整理汇总了PHP中Audit::log方法的典型用法代码示例。如果您正苦于以下问题:PHP Audit::log方法的具体用法?PHP Audit::log怎么用?PHP Audit::log使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Audit
的用法示例。
在下文中一共展示了Audit::log方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create
public function create($login, $details = NULL)
{
if (!preg_match('/^[a-zA-Z0-9\\.\\_\\-]+$/', $login)) {
http_response_code(409);
echo "Invalid username";
return NULL;
}
$user = $this->find($login);
if ($user != NULL) {
http_response_code(409);
echo "User already exists";
return NULL;
}
if ($user == NULL && $this->useLdap()) {
$user = $this->createFromLdap($login);
if ($user != NULL) {
Audit::log($this->current_user ? $this->current_user : $user, 'imported user ' . $user, $user);
}
}
if ($user == NULL && $this->current_user != NULL && $this->current_user->isAdmin()) {
if ($details == NULL) {
$details = array('login' => $login);
}
$user = $this->users->create($details);
if ($user == NULL) {
http_response_code(500);
echo "Failed to create user";
die;
} else {
Audit::log($this->current_user, 'created user ' . $user, $user);
}
}
if ($user == NULL) {
http_response_code(403);
echo "Access denied";
die;
}
return $user;
}
示例2: audit
/**
* @param array $data
* @param int $level
* @param string $type The type of audit entry
*
* @return bool
*/
function audit($data = [], $level = AuditLevels::INFO, $type = null)
{
return \Audit::log($data, $level, app('request'), $type);
}