uniqid() generating same string on each create record.

Posted 11 months ago by jlsodai

I am quite new to Laravel and need your help. I want to create a unique string for the uniq field... But laravel is giving me the same value over and over again. Any help on why this is happening or a better way to generate a unique but not too long id (eg. 5a5971196db9e) will be much appreciated.

Schema::create('schools', function (Blueprint $table) {

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up


Reply to

Use Markdown with GitHub-flavored code blocks.