Support the ongoing development of Laravel.io →
Database Eloquent
Last updated 2 years ago.
0

You can't just let out the incremental ID and make sure your save method, when it's a new entry, generates an ID from your preference?

0

public $incrementing = false; on your model indicates the ids are not auto-incrementing.

0

In fact am looking to generate some random ID like Youtube.. Something like this: ggPo8mbb_dep and not use the simple numeric ID

Last updated 8 years ago.
0

Maybe it will be helpful => http://hashids.org/php/ It creates YT-like IDs from number ID.

0

As lukasz mentioned, hashids are probably what you are looking for.

0

The problem is I have to rewrite the find method and some other method that give the ID... I wonder if there is a package or if someone already did it ?

0

Sign in to participate in this thread!

Eventy

Your banner here too?

LonnyX lonnyx Joined 30 Mar 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.