You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
xshop/database/factories/CustomerFactory.php

39 lines
891 B
PHP

<?php
namespace Database\Factories;
use App\Models\Address;
use App\Models\Customer;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Model>
*/
class CustomerFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition()
{
$state = rand(1,31);
$k = array_keys(Address::$cities[$state]);
shuffle($k);
return [
//
'name' => $this->faker->name,
'address' => $this->faker->address,
'mobile' => '0912'.rand(1111111,9999999),
'email' => $this->faker->unique()->email,
'state' => $state,
'city' => $k[0],
'password' => bcrypt('password'),
'credit' => 0,
];
}
}