xetaio / xetaravel-iptraceable
一个简单的包,当用户登录应用程序时更新IP字段。
11.0.0
2024-06-18 08:34 UTC
Requires
- php: >=8.2
- illuminate/auth: ^11.0
- illuminate/contracts: ^11.0
- illuminate/database: ^11.0
- illuminate/http: ^11.0
- illuminate/support: ^11.0
- nesbot/carbon: ^3.0
Requires (Dev)
README
Xetaravel IpTraceable
一个简单的包,当用户登录应用程序时更新IP字段。同时与
remember_me
令牌兼容。要求
安装
composer require xetaio/xetaravel-iptraceable
服务提供商
在你的
config/app.php
中导入IpTraceableServiceProvider
'providers' => [ //... Xetaio\IpTraceable\Providers\IpTraceableServiceProvider::class, //... ]中间件
在你的
app/Http/Kernel.php
中的web
部分导入IpTraceable
中间件protected $middlewareGroups = [ 'web' => [ //... \Illuminate\Session\Middleware\StartSession::class, \Xetaio\IpTraceable\Http\Middleware\IpTraceable::class, //... ], //... ];注意 : 非常重要的是在导入中间件后导入
Illuminate\Session\Middleware\StartSession
中间件,因为这个包使用了会话。配置文件
将包的配置文件发布到你的应用程序中
php artisan vendor:publish --provider="Xetaio\IpTraceable\Providers\IpTraceableServiceProvider" --tag=config
数据库
在你的数据库中创建2个字段
last_login_ip
和last_login_date
(可选)// Must be nullable $table->ipAddress('last_login_ip')->nullable(); $table->dateTime('last_login_date')->nullable(); // (optional) Disabled by default字段名称可以在配置文件中更改。
贡献
如果你想通过添加新功能或修复bug来为项目做出贡献,请随意提交PR。