承接 cerutti-maicon/laravel-activitylog-for-tenancy-for-laravel 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

cerutti-maicon/laravel-activitylog-for-tenancy-for-laravel

最新稳定版本:2.0.2

Composer 安装命令:

composer require cerutti-maicon/laravel-activitylog-for-tenancy-for-laravel

包简介

A very simple activity logger to monitor users of your website or application by tenant, using laravel-for-tenancy

README 文档

README

Latest Version on Packagist Total Downloads

This project is a fork of spatie/laravel-activitylog.

Now compatible with Laravel 10.

What we want with this fork is to make it possible for the logs not to be centralized in a single table. Over time, all system logs end up generating a table with many records, and to alleviate this problem, the proposal here is to use the package Tenancy for Laravel to create a second tenant , with the nomenclature having a _logs suffix. And so making each tenant have 2 databases.

To proceed with the implementations of Logs you should still use the documentation from Spetie Laravel-activitylog.

The changes in this package were that an attribute for the useLogName function must always be informed, as this attribute will define the name of the table to save the log data informed by the getActivitylogOptions function applied to the model.

public function getActivitylogOptions()
{
    return LogOptions::defaults()
    ->useLogName('system');
}

Installation

You can install the package via composer:

composer require cerutti-maicon/laravel-activitylog-for-tenancy-for-laravel                          

The package will automatically register itself.

You can publish the migration with:

php artisan vendor:publish --provider="Spatie\Activitylog\ActivitylogServiceProvider" --tag="activitylog-migrations"

Yes, this command remains the same

Compulsorily, you can publish the configuration file with:

php artisan vendor:publish --provider="Spatie\Activitylog\ActivitylogServiceProvider" --tag="activitylog-config"

Note that there are some extra settings tenant_model and tenant_seeder_model. These settings are used to define the template that will be used to create the tenant and the template that will be used to create the tenant propagator. They must be met according to each project implementation.

Create the databases following the prefix pattern for the main tenants:

Example:

tenant_main
tenant_main_logs

After publishing the migration, you can run the migrations with the following command:

php artisan multi_tenants_logs:migrate

The above command also generates the records of the tenants from logs in the tenants table of the application's central database.

Note that there is a run of a seeder that truncates the migrations table. Yes, this is done on purpose, so that the tables created in the tenant logs contain the same tables as the main tenant automatically, so the developer doesn't have to recreate other migrations for this function.

It is extremely important for this package to work that MultiActivity is listed in the project configuration, it is thanks to this that the connections are switched between the main tenant and the log tenant.

Commands

The package comes with some artisan commands to run the migrations and seeder only for the main tenants, the tenant logs should work automatically:

Migrate for Tenant Logs

It must be run for each new table created in the main tenant, in order to be able to generate the logs for it.

php artisan multi_tenants_logs:migrate

Migrate for Tenant Main

It should be executed when the objective is to run migrations only for the main tenants.

php artisan multi_tenants:list

This command lists all tenants in the system

php artisan multi_tenants:migrate

Has --tenants option to run for a specific tenant

php artisan multi_tenants:seed

Has --class and --tenants option to run for a specific tenant

Warning

It is extremely discouraged to continue to use the native commands from the Tenancy for Laravel package.

For example:

php artisan tenants:migrate

This command does not differentiate between the main tenant and the log tenant

Because it is not making any difference between main tenant and log tenant, it would be at your own risk to run migrations from different migration directories (some more basic validations were implemented to prevent these types of errors, but only if you use the native commands of this one package).

License

The MIT License (MIT). Please see License File for more information.

cerutti-maicon/laravel-activitylog-for-tenancy-for-laravel 适用场景与选型建议

cerutti-maicon/laravel-activitylog-for-tenancy-for-laravel 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 392 次下载、GitHub Stars 达 2, 最近一次更新时间为 2022 年 09 月 04 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「log」 「user」 「laravel」 「activity」 「tenancy」 「spatie」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 cerutti-maicon/laravel-activitylog-for-tenancy-for-laravel 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 cerutti-maicon/laravel-activitylog-for-tenancy-for-laravel 我们能提供哪些服务?
定制开发 / 二次开发

基于 cerutti-maicon/laravel-activitylog-for-tenancy-for-laravel 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 392
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 16
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 0
  • Forks: 743
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-09-04