{"repo":"mtvs/eloquent-hashids","free":true,"listed":false,"github":"https://github.com/mtvs/eloquent-hashids","clone":"git clone https://github.com/mtvs/eloquent-hashids.git","description":"On-the-fly hashids for Laravel Eloquent models. (🍰 Easy & ⚡ Fast)","language":"PHP","stars":291,"topics":["laravel","eloquent","php","hashids","eloquent-models"],"license":null,"category":"databases-storage","readme_excerpt":"Using hashids instead of integer ids in urls and list items can be more appealing and clever. For more information visit hashids.org. Eloquent-Hashids This adds hashids to Laravel Eloquent models by encoding/decoding them on the fly rather than persisting them in the database. So no need for another database column and also higher performance by using primary keys in queries. Features include: Generating hashids for models Resloving hashids to models Ability to customize hashid settings for each model Route binding with hashids (optional) Installation Install the package with Composer: Also, publish the vendor config files to your application (necessary for the dependencies): Setup Base features are provided by using HasHashid trait then route binding with hashids can be added by using HashidRouting . Custom Hashid Settings It's possible to customize hashids settings for each model by overwriting getHashidsConnection() . It must return the name of a connection of vinkla/hashids that provides the desired settings. Usage Basics Add the hashid to the serialized model Set it as default: or specify it specificly: return $item- append('hashid')- toJson(); Implicit Route Bindings If you want to resolve implicit route bindings for the model using its hahsid value you can use HashidRouting in the model. It overwrites getRouteKeyName() , getRouteKey() and resolveRouteBindingQuery() to use the hashids as the route keys. It supports the Laravel's feature for customizing the key for speci","default_branch":null,"files":null,"tree":[],"storefront":"/r/mtvs","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/mtvs/eloquent-hashids/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}