You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
1.5 KiB

2 years ago
2 years ago
  1. <?php
  2. namespace Database\Factories;
  3. use App\Documents\UserDocument;
  4. use App\Models\ILaravel;
  5. use Illuminate\Database\Eloquent\Factories\Factory;
  6. use Illuminate\Support\Str;
  7. /**
  8. * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User>
  9. */
  10. class ILaravelFactory extends Factory
  11. {
  12. use BaseFactory;
  13. protected $model = ILaravel::class;
  14. /**
  15. * Define the model's default state.
  16. *
  17. * @return array<string, mixed>
  18. */
  19. public function definition()
  20. {
  21. return [
  22. 'group_id' => 1,
  23. 'user_id' => 100,
  24. 'name' => fake()->name(),
  25. 'email' => fake()->safeEmail(),
  26. 'email_verified_at' => now(),
  27. 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
  28. 'remember_token' => Str::random(10),
  29. ];
  30. }
  31. public static function list()
  32. {
  33. return [
  34. 'name:null',
  35. 'name:numeric',
  36. 'name:gtString',
  37. 'email:null',
  38. 'email:numeric',
  39. 'email:ltString',
  40. 'email:unique',
  41. ];
  42. }
  43. public function testGeneratorConfig()
  44. {
  45. return [
  46. 'store' => 'profile, guest',
  47. 'update' => 'profile, guest',
  48. 'show' => '',
  49. 'delete' => '',
  50. ];
  51. }
  52. public function dependencyProvider($dependencyAttributes= [])
  53. {
  54. return [
  55. 'user_id' => UserDocument::factory()->create()->id
  56. ];
  57. }
  58. }