Reputation: 1
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
Upvotes: 0
Views: 189
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
Reputation: 24
Try below code: use Illuminate\Support\Int;
or
'nip' => \Int::random(10);
Upvotes: 0
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