本文整理匯總了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);
}