feat: add factory for models

This commit is contained in:
amir-ys
2024-11-23 22:14:01 +03:30
parent 26a0acb1d2
commit a74492e488
36 changed files with 600 additions and 16 deletions
+11 -2
View File
@@ -2,6 +2,7 @@
namespace Database\Factories;
use App\Models\MedicalCenter;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
@@ -17,9 +18,17 @@ class UserFactory extends Factory
return [
'name' => $this->faker->name,
'email' => $this->faker->unique()->safeEmail,
'email_verified_at' => now(),
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
'country_code' => '0098',
'cell_number' => $this->faker->phoneNumber,
'gender' => $this->faker->randomElement(['Male', 'FeMale']),
'verified' => $this->faker->randomElement(['Verified', 'NotVerified']),
'status' => $this->faker->randomElement(['Active', 'Suspended']),
'medical_center_id' => MedicalCenter::factory(), // ایجاد مرکز پزشکی به طور خودکار
'password' => bcrypt('password'), // رمز عبور پیش‌فرض
'address' => $this->faker->optional()->address,
'remember_token' => Str::random(10),
'created_at' => now(),
'updated_at' => now(),
];
}
}