diff --git a/app/Listeners/User/CreatedUserActivity.php b/app/Listeners/User/CreatedUserActivity.php new file mode 100644 index 000000000000..35bd06a336e4 --- /dev/null +++ b/app/Listeners/User/CreatedUserActivity.php @@ -0,0 +1,40 @@ +activityRepo = $activityRepo; + } + + /** + * Handle the event. + * + * @param object $event + * @return void + */ + public function handle($event) + { + + $fields = new \stdClass; + + $fields->user_id = auth()->user()->id; + $fields->company_id = $event->user->company_id; + $fields->activity_type_id = Activity::CREATE_USER; + + $this->activityRepo->save($fields, $event->user); + } +} diff --git a/app/Models/Activity.php b/app/Models/Activity.php index 30bb6dafda5d..1987eec4bbdc 100644 --- a/app/Models/Activity.php +++ b/app/Models/Activity.php @@ -52,13 +52,18 @@ class Activity extends BaseModel const DELETE_TASK=45; const RESTORE_TASK=46; const UPDATE_EXPENSE=47; + const CREATE_USER=48; + const UPDATE_USER=49; + const ARCHIVE_USER=50; + const DELETE_USER=51; + const RESTORE_USER=52; public function backup() { return $this->hasOne(Backup::class); } - + /** * @return mixed */