|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Database\Factories; |
|
4
|
|
|
|
|
5
|
|
|
use App\Enum\Gender; |
|
6
|
|
|
use App\Models\Customer; |
|
7
|
|
|
use Illuminate\Database\Eloquent\Factories\Factory; |
|
8
|
|
|
use Illuminate\Http\UploadedFile; |
|
9
|
|
|
use Illuminate\Support\Carbon; |
|
10
|
|
|
use Illuminate\Support\Str; |
|
11
|
|
|
|
|
12
|
|
|
class CustomerFactory extends Factory |
|
13
|
|
|
{ |
|
14
|
|
|
/** |
|
15
|
|
|
* The name of the factory's corresponding model. |
|
16
|
|
|
* |
|
17
|
|
|
* @var string |
|
18
|
|
|
*/ |
|
19
|
|
|
protected $model = Customer::class; |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* Define the model's default state. |
|
23
|
|
|
* |
|
24
|
|
|
* @return array |
|
25
|
|
|
*/ |
|
26
|
|
|
public function definition() |
|
27
|
|
|
{ |
|
28
|
|
|
$gender = $this->faker->randomElement(Gender::toValues()); |
|
29
|
|
|
|
|
30
|
|
|
return [ |
|
31
|
|
|
'telegram_chat_id' => $this->faker->numerify('#########'), |
|
32
|
|
|
'username' => $this->faker->userName, |
|
33
|
|
|
'fullname' => $this->faker->name($gender), |
|
34
|
|
|
'gender' => $gender, |
|
35
|
|
|
'email' => $this->faker->unique()->safeEmail(), |
|
36
|
|
|
'phone_country' => env('PHONE_COUNTRY', 'ID'), |
|
37
|
|
|
'phone' => $this->faker->numerify('081#########'), |
|
38
|
|
|
'whatsapp_phone_country' => env('PHONE_COUNTRY', 'ID'), |
|
39
|
|
|
'whatsapp_phone' => $this->faker->numerify('081#########'), |
|
40
|
|
|
'account_number' => $this->faker->numerify('#########'), |
|
41
|
|
|
'identitycard_number' => $this->faker->numerify('################'), |
|
42
|
|
|
'identitycard_image' => UploadedFile::fake()->image(Str::random() . '.jpg'), |
|
43
|
|
|
'location_latitude' => $this->faker->latitude, |
|
44
|
|
|
'location_longitude' => $this->faker->longitude, |
|
45
|
|
|
]; |
|
46
|
|
|
} |
|
47
|
|
|
} |
|
48
|
|
|
|