<?php use Vis\Builder\Event as EventModel; Event::listen("setting.changed", function ($settings) { EventModel::create(array("id_user" => Sentry::getUser()->id, "ip_user" => Request::getClientIp(true), "message" => "Изменил настройку id#" . $settings->id, "model" => get_class($settings), "id_record" => $settings->id, "action" => "changed")); }); Event::listen("setting.delete", function ($settings) { EventModel::create(array("id_user" => Sentry::getUser()->id, "ip_user" => Request::getClientIp(true), "message" => "Удалил настройку id#" . $settings->id, "model" => get_class($settings), "id_record" => $settings->id, "action" => "deleted")); }); Event::listen("setting.created", function ($settings) { EventModel::create(array("id_user" => Sentry::getUser()->id, "ip_user" => Request::getClientIp(true), "message" => "Создал настройку id#" . $settings->id, "model" => get_class($settings), "id_record" => $settings->id, "action" => "created")); });
<?php use Vis\Builder\Event as EventModel; Event::listen("table.clone", function ($model, $id) { EventModel::create(array("id_user" => Sentry::getUser()->id, "ip_user" => Request::getClientIp(true), "message" => "Клонирование статьи", "model" => $model, "id_record" => $id, "action" => "clone")); }); Event::listen("table.delete", function ($model, $id) { EventModel::create(array("id_user" => Sentry::getUser()->id, "ip_user" => Request::getClientIp(true), "message" => "Удаление статьи", "model" => $model, "id_record" => $id, "action" => "delete")); }); Event::listen("table.updated", function ($model, $id) { EventModel::create(array("id_user" => Sentry::getUser()->id, "ip_user" => Request::getClientIp(true), "message" => "Редактирование статьи", "model" => $model, "id_record" => $id, "action" => "updated")); });
<?php use Vis\Builder\Event as EventModel; Event::listen("user.login", function () { EventModel::create(array("id_user" => Sentry::getUser()->id, "ip_user" => Request::getClientIp(true), "message" => "Пользователь id" . Sentry::getUser()->id . " вошел в админку", "model" => get_class(Sentry::getUser()), "id_record" => Sentry::getUser()->id, "action" => "login")); }); Event::listen("user.logout", function () { EventModel::create(array("id_user" => Sentry::getUser()->id, "ip_user" => Request::getClientIp(true), "message" => "Пользователь id#" . Sentry::getUser()->id . " вышел из админки", "model" => get_class(Sentry::getUser()), "id_record" => Sentry::getUser()->id, "action" => "logout")); }); Event::listen("user.login_error", function () { EventModel::create(array("id_user" => 0, "ip_user" => Request::getClientIp(true), "message" => "Ошибка входа в админку", "model" => "User", "id_record" => 0, "action" => "error_login")); });
<?php use Vis\Builder\Event as EventModel; Event::listen("translate.created", function ($model) { EventModel::create(array("id_user" => Sentry::getUser()->id, "ip_user" => Request::getClientIp(true), "message" => "Пользователь создал перевод для CMS", "model" => get_class($model), "id_record" => $model->id, "action" => "created")); }); Event::listen("translate.update_phrase", function ($model) { EventModel::create(array("id_user" => Sentry::getUser()->id, "ip_user" => Request::getClientIp(true), "message" => "Пользователь изменил перевод для CMS", "model" => get_class($model), "id_record" => $model->id, "action" => "update")); }); Event::listen("translate.delete", function ($model) { EventModel::create(array("id_user" => Sentry::getUser()->id, "ip_user" => Request::getClientIp(true), "message" => "Пользователь удалил перевод для CMS", "model" => get_class($model), "id_record" => $model->id, "action" => "delete")); });