russofinn / laravel-interactions
一个用于记录您网站或应用上用户交互的简单包。
Requires
- php: ^7.0
- illuminate/config: ~5.5.0|~5.6.0|~5.7.0
- illuminate/database: ~5.5.0|~5.6.0|~5.7.0
- illuminate/support: ~5.5.0|~5.6.0|~5.7.0
Requires (Dev)
- orchestra/testbench: ~3.5.0|~3.6.0|~3.7.0
- phpunit/phpunit: ^6.2|^7.0
This package is auto-updated.
Last update: 2024-09-07 16:18:55 UTC
README
该 russofinn/laravel-interactions 包提供了方便使用的功能,用于记录您应用中的用户交互。
以下是如何使用它的示例:
interactions()->comment('Look, I said something.');
您可以使用模型 Russofinn\Interactions\Models\Comment、Russofinn\Interactions\Models\Like、Russofinn\Interactions\Models\View 和 Russofinn\Interactions\Models\Mention 来检索所有交互。
文档
您可以在 https://docs.spatie.be/laravel-activitylog/v2 找到相关文档。
如果您在使用该包时遇到问题,发现了一个错误,或者有关于改进活动日志的一般性问题或建议,请随时在 GitHub 上 创建问题,我们将尽快处理。
如果您发现了一个安全问题,请通过电子邮件 freek@spatie.be 而不是使用问题跟踪器来报告。
安装
您可以通过 composer 安装此包。
composer require russofinn/laravel-interactions
包将被自动注册。
您可以使用以下命令发布迁移:
php artisan vendor:publish --provider="Russofinn\Interactions\InteractionsServiceProvider" --tag="migrations"
注意:默认迁移假定您正在使用整数作为 ID。如果您正在使用 UUID 或其他格式,请在继续之前调整迁移中的 subject_id 和 causer_id 字段的格式。
发布迁移后,您可以通过执行以下命令来创建 comments、likes、views 和 mentions 表:
php artisan migrate
您可以选择使用以下命令发布配置文件:
php artisan vendor:publish --provider="Russofinn\Interactions\InteractionsServiceProvider" --tag="config"
以下是发布配置文件的内容:
return [ /* * You can specify an auth driver here that gets user models. * If this is null we'll use the default Laravel auth driver. */ 'default_auth_driver' => null, /* * If set to true, the subject returns soft deleted models. */ 'subject_returns_soft_deleted_models' => false, 'mentions' => [ /* * If set to true, the subject returns soft deleted models. */ 'character' => '@', 'regex' => '/\s({character}{pattern}{rules})/', 'regex_replacement' => [ '{character}' => '@', '{pattern}' => '[A-Za-z0-9]', '{rules}' => '{4,20}' ], /* * Model that will be mentioned. */ 'model' => 'App\User', /* * The column that will be used to search the model by the parser. */ 'column' => 'username', /* * The route used to generate the user link when mention */ 'route' => '/users/profile/@' ], /* * This model will be used to log activity. The only requirement is that * it should be or extend the Russofinn\Interactions\Models\Commenty model. */ 'comment_model' => \Russofinn\Interactions\Models\Comment::class, /* * This model will be used to log activity. The only requirement is that * it should be or extend the Russofinn\Interactions\Models\Like model. */ 'like_model' => \Russofinn\Interactions\Models\Like::class, /* * This model will be used to log activity. The only requirement is that * it should be or extend the Russofinn\Interactions\Models\View model. */ 'view_model' => \Russofinn\Interactions\Models\View::class, /* * This model will be used to log activity. The only requirement is that * it should be or extend the Russofinn\Interactions\Models\Mention model. */ 'mention_model' => \Russofinn\Interactions\Models\Mention::class, /* * This is the name of the table that will be created by the migration and * used by the Comment model shipped with this package. */ 'table_name_comments' => 'comments', /* * This is the name of the table that will be created by the migration and * used by the View model shipped with this package. */ 'table_name_mentions' => 'mentions' /* * This is the name of the table that will be created by the migration and * used by the Like model shipped with this package. */ 'table_name_likes' => 'likes', /* * This is the name of the table that will be created by the migration and * used by the View model shipped with this package. */ 'table_name_views' => 'views' ];
更新日志
通过查看 CHANGELOG 了解最近更改的详细信息。
测试
$ composer test
贡献
有关详细信息,请参阅 CONTRIBUTING。
安全
如果您发现与安全相关的问题,请通过电子邮件 almeida.weslley577@gmail.com 而不是通过打开 ISSUE 来报告。
鸣谢
许可
本包在 MIT 许可证 (MIT) 下提供。有关更多信息,请参阅 许可文件。