Erza Fahmi Fasya
Erza Fahmi Fasya

Reputation: 1

Error when create db:seed as interger in laravel

I want to make the seed data in the form of a string and interger, but when I create an error "int" is not recognized

This's my code

enter image description here

enter image description here

Upvotes: 0

Views: 189

Answers (3)

Kenny Horna
Kenny Horna

Reputation: 14241

That is because there's no Int facade.

You can check in the helpers section of the docs, the only helper classes are Arr and Str.

What you could do, as the other answers recommend, is to use a native PHP function (like mt_rand()) to randomly generate integers:

$randomInteger = mt_rand($min = 0, $max = null);

Upvotes: 0

Amir khan
Amir khan

Reputation: 24

Try below code: use Illuminate\Support\Int;

or

'nip' => \Int::random(10);

Upvotes: 0

STA
STA

Reputation: 34688

You can use PHP native function rand() :

rand(1,999); // rand(min,max)

Or, use the mt_rand(min,max) to make bigger integers :

mt_rand(1000000000, 9999999999);

Upvotes: 1

Related Questions