Comments (5)
Thanks for your advice, and I also have several hashid traits in my projects. This package is just a manager for multiple connections and various encode drivers, I think it is better to let package users use it as they want, or define their own traits based on different requirements.
from laravel-hashid.
Trait implementation is the same in the every project, that's why I think it can be included to the package.
Ofcourse I would modify above code to be more customizable and I would include parameters for "key" name and for connection instead of "newHashId()" method.
from laravel-hashid.
YES, I know your opinion. What I said "different requirements", such as multiple hashed columns, or keep the original value for internal use but expose the hashed value in URL or response data.
For obfuscating the primary key or other sensitive columns, I prefer a non-invasive way to do this. I mean do not change the way of retrieving or saving the Eloquent ORM, do not need to explicitly call such findByHash
findOrFailByHash
methods, the hashing work should be automatically done in the route model binding, toJson()
etc. In fact, when I developed this package, I'd like to provide such a function, but there are some issues on Laravel route model binding at that time, these issues may be fixed now, I have not used Laravel for two years.
from laravel-hashid.
Well, this approach is quite suitable for Laravel 6.x. Though there is always more than one solution and this could be the start. If you don't have time for this, I could use this repo as dependency and add these traits to a new repo
from laravel-hashid.
A new repo is great 👍
from laravel-hashid.
Related Issues (13)
- [Insight] Usage of a function in loops should be avoided - in src/Console/AlphabetGenerateCommand.php, line 31
- dont support laravel5.7 HOT 4
- 能够实现多个参数加密吗? 包含字符串 数字 特殊字符 HOT 1
- Drop support for PHP 5.x, update hashids dependency to 3.x HOT 1
- option() may return array
- 能直接应用在model中吗? HOT 5
- Laravel 7 support HOT 2
- Laravel 8.0 Support HOT 2
- The class Laravel\Lumen\Application does not exist. Did you forget a USE statement, or did you not list all dependencies?
- 是否支持在laravel10中使用? HOT 2
- 可以支持中文吗?
- Support Laravel 11 and PHP 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel-hashid.