Menu
  • HOME
  • TAGS

Use Hashids library to hash ids on Laravel eloquent collection

php,laravel,laravel-5,hashids

You could do it using an accessor method. First, append a new attribute at the top of your Task model: protected $appends = ['hashid']; Then, in the same model, create an accessor that populates the attribute: public function getHashidAttribute() { return Hashids::encode($this->attributes['id']); } Once you have those, just call the...