|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace GiveBlood\Modules\Users; |
|
4
|
|
|
|
|
5
|
|
|
use GiveBlood\Modules\Blood\BloodType; |
|
6
|
|
|
use GiveBlood\Support\Database\ModelFactory; |
|
7
|
|
|
|
|
8
|
|
|
/* |
|
9
|
|
|
|-------------------------------------------------------------------------- |
|
10
|
|
|
| User Model Factory |
|
11
|
|
|
|-------------------------------------------------------------------------- |
|
12
|
|
|
| |
|
13
|
|
|
| This directory should contain each of the model factory definitions for |
|
14
|
|
|
| your application. Factories provide a convenient way to generate new |
|
15
|
|
|
| model instances for testing / seeding your application's database. |
|
16
|
|
|
| |
|
17
|
|
|
*/ |
|
18
|
|
|
class UserFactory extends ModelFactory |
|
19
|
|
|
{ |
|
20
|
|
|
protected $model = User::class; |
|
21
|
|
|
|
|
22
|
|
|
protected function fields() |
|
23
|
|
|
{ |
|
24
|
|
|
static $password; |
|
25
|
|
|
|
|
26
|
|
|
return [ |
|
27
|
|
|
'id' => $this->faker->uuid, |
|
28
|
|
|
'first_name' => $this->faker->firstName, |
|
29
|
|
|
'last_name' => $this->faker->lastName, |
|
30
|
|
|
'email' => $this->faker->unique()->safeEmail, |
|
31
|
|
|
'email_verified_at' => now(), |
|
32
|
|
|
'username' => $this->faker->userName(20), |
|
33
|
|
|
'phone' => $this->faker->tollFreePhoneNumber, |
|
|
|
|
|
|
34
|
|
|
'bio' => $this->faker->text($maxNbChars = 100), |
|
35
|
|
|
'birthdate' => $this->faker->date, |
|
36
|
|
|
'country_id' => factory(Country::class)->make()->id, |
|
37
|
|
|
'blood_type_id' => factory(BloodType::class)->make()->id, |
|
38
|
|
|
'password' => $password ?: $password = bcrypt('secret'), |
|
39
|
|
|
'remember_token' => \Str::random(10), |
|
40
|
|
|
]; |
|
41
|
|
|
} |
|
42
|
|
|
} |
|
43
|
|
|
|
An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.
If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.