13
13
use App \Tasting \TastingSession ;
14
14
use App \Wine ;
15
15
use App \WineQuality ;
16
- use Faker \Generator as FakeData ;
17
16
18
17
$ factory ->define (User::class,
19
18
function () {
@@ -35,16 +34,16 @@ function () {
35
34
$ factory ->define (Association::class,
36
35
function () {
37
36
return [
38
- 'id ' => rand (10000 , 99000 ),
37
+ 'id ' => random_int (10000 , 99000 ),
39
38
'name ' => str_random (10 ),
40
39
'wuser_username ' => null ,
41
40
];
42
41
});
43
42
44
43
$ factory ->define (Applicant::class,
45
- function (FakeData $ faker ) {
44
+ function () {
46
45
return [
47
- 'id ' => rand (10000 , 999999 ),
46
+ 'id ' => random_int (10000 , 999999 ),
48
47
'association_id ' => function () {
49
48
return factory (Association::class)->create ()->id ;
50
49
},
@@ -54,23 +53,23 @@ function (FakeData $faker) {
54
53
},
55
54
'label ' => str_random (10 ),
56
55
'title ' => 'Dr. ' ,
57
- 'firstname ' => $ faker -> firstName ,
58
- 'lastname ' => $ faker -> lastName ,
59
- 'phone ' => substr ( $ faker -> phoneNumber , 0 , 20 ),
60
- 'fax ' => substr ( $ faker -> phoneNumber , 0 , 20 ),
61
- 'mobile ' => substr ( $ faker -> phoneNumber , 0 , 20 ),
62
- 'email ' => $ faker -> email ,
63
- 'web ' => substr ( $ faker -> url , 0 , 50 ) ,
56
+ 'firstname ' => str_random ( 20 ) ,
57
+ 'lastname ' => str_random ( 20 ) ,
58
+ 'phone ' => random_int ( 10000 , 100000000 ),
59
+ 'fax ' => random_int ( 10000 , 100000000 ),
60
+ 'mobile ' => random_int ( 10000 , 100000000 ),
61
+ 'email ' => str_random ( 8 ) . ' @ ' . str_random ( 5 ) . ' .com ' ,
62
+ 'web ' => str_random ( 10 ) . ' .com ' ,
64
63
];
65
64
});
66
65
67
66
$ factory ->define (Address::class,
68
- function (FakeData $ faker ) {
67
+ function () {
69
68
return [
70
- 'street ' => $ faker -> streetAddress ,
71
- 'nr ' => $ faker -> numberBetween (1 , 300 ),
72
- 'zipcode ' => $ faker -> numberBetween (1000 , 9999 ),
73
- 'city ' => $ faker -> city ,
69
+ 'street ' => str_random ( 20 ) ,
70
+ 'nr ' => random_int (1 , 300 ),
71
+ 'zipcode ' => random_int (1000 , 9999 ),
72
+ 'city ' => str_random ( 10 ) ,
74
73
];
75
74
});
76
75
@@ -86,12 +85,12 @@ function () {
86
85
$ factory ->define (Wine::class,
87
86
function () {
88
87
return [
89
- 'nr ' => rand (1 , 1000 ),
88
+ 'nr ' => random_int (1 , 1000 ),
90
89
'label ' => str_random (10 ),
91
- 'vintage ' => rand (2005 , 2020 ),
92
- 'alcohol ' => rand (1 , 200 ) / 10 ,
93
- 'acidity ' => rand (1 , 200 ) / 10 ,
94
- 'sugar ' => rand (1 , 300 ) / 10 ,
90
+ 'vintage ' => random_int (2005 , 2020 ),
91
+ 'alcohol ' => random_int (1 , 200 ) / 10 ,
92
+ 'acidity ' => random_int (1 , 200 ) / 10 ,
93
+ 'sugar ' => random_int (1 , 300 ) / 10 ,
95
94
'approvalnr ' => str_random (15 ),
96
95
'winesort_id ' => function () {
97
96
return factory (WineSort::class)->create ()->id ;
@@ -102,22 +101,22 @@ function () {
102
101
'applicant_id ' => function () {
103
102
return factory (Applicant::class)->create ()->id ;
104
103
},
105
- 'winequality_id ' => rand (1 , 10 ), // Hard-coded, but should exist in DB
104
+ 'winequality_id ' => random_int (1 , 10 ), // Hard-coded, but should exist in DB
106
105
];
107
106
});
108
107
109
108
$ factory ->define (WineQuality::class,
110
109
function () {
111
110
return [
112
- 'id ' => rand (100 , 1000 ),
111
+ 'id ' => random_int (100 , 1000 ),
113
112
'label ' => str_random (10 ),
114
113
'abbr ' => strtoupper (str_random (3 )),
115
114
];
116
115
});
117
116
118
117
$ factory ->define (WineSort::class, function () {
119
118
return [
120
- 'order ' => rand (1 , 50000 ),
119
+ 'order ' => random_int (1 , 50000 ),
121
120
'name ' => str_random (10 ),
122
121
'quality_allowed ' => '[] ' ,
123
122
];
@@ -126,11 +125,11 @@ function () {
126
125
$ factory ->define (TastingNumber::class,
127
126
function () {
128
127
return [
129
- 'tastingstage_id ' => rand (1 , 2 ),
128
+ 'tastingstage_id ' => random_int (1 , 2 ),
130
129
'wine_id ' => function () {
131
130
return factory (Wine::class)->create ()->id ;
132
131
},
133
- 'nr ' => rand (1 , 5000 ),
132
+ 'nr ' => random_int (1 , 5000 ),
134
133
];
135
134
});
136
135
@@ -139,8 +138,8 @@ function () {
139
138
'competition_id ' => function () {
140
139
return factory (Competition::class)->create ()->id ;
141
140
},
142
- 'tastingstage_id ' => rand (1 , 2 ),
143
- 'nr ' => rand (1 , 100 ),
141
+ 'tastingstage_id ' => random_int (1 , 2 ),
142
+ 'nr ' => random_int (1 , 100 ),
144
143
'locked ' => false ,
145
144
];
146
145
});
@@ -159,7 +158,7 @@ function () {
159
158
'commission_id ' => function () {
160
159
return factory (Commission::class)->create ()->id ;
161
160
},
162
- 'nr ' => rand (1 , 1000 ),
161
+ 'nr ' => random_int (1 , 1000 ),
163
162
'name ' => str_random (10 ),
164
163
'active ' => true ,
165
164
];
0 commit comments