leuverink / eloquent-hashid-binding
使用hashid的eloquent路由模型绑定的简单解决方案
1.4.0
2024-04-30 09:32 UTC
Requires
- hashids/hashids: ^4.0
- illuminate/support: 5.5.* || 5.6.* || 5.7.* || 5.8.* || 6.* || 7.* || 8.* || 9.* || 10.*
Requires (Dev)
- codedungeon/phpunit-result-printer: ^0.26.2
- orchestra/testbench: ^3.8
- phpunit/phpunit: ^8.2
This package is auto-updated.
Last update: 2024-08-30 10:06:33 UTC
README
为eloquent隐式路由模型绑定提供hashid的简单解决方案。
隐藏您应用id以防止他人窥探。
本包的作用
当使用在URL中时,本包会隐藏eloquent模型的id。当您不想将id暴露给外界时,这非常有用。
路由键会即时编码/解码。您可以将此直接放入任何Laravel项目中,无需迁移。
安装
composer require leuverink/eloquent-hashid-binding
基本用法
只需在您的eloquent模型中使用HashidBinding特质,然后即可开始使用!
namespace App; use Illuminate\Foundation\Auth\User as Authenticatable; use Leuverink\HashidBinding\HashidBinding; class User extends Authenticatable { use HashidBinding; // }
就是这样!更多信息请查看文档。
