Skip to content

Commit

Permalink
Refactor factory & seeder
Browse files Browse the repository at this point in the history
  • Loading branch information
ikhsan3adi committed Jun 30, 2024
1 parent 3ccda61 commit cef76a3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion database/factories/UserFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

namespace Database\Factories;

use App\Models\Division;
use App\Models\Education;
use App\Models\JobTitle;
use App\Models\Team;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
Expand Down Expand Up @@ -43,7 +46,9 @@ public function definition(): array
'two_factor_recovery_codes' => null,
'remember_token' => Str::random(10),
'profile_photo_path' => null,
// 'current_team_id' => null,
'education_id' => Education::inRandomOrder()->first()?->id,
'division_id' => Division::inRandomOrder()->first()?->id,
'job_title_id' => JobTitle::inRandomOrder()->first()?->id,
];
}

Expand Down
2 changes: 1 addition & 1 deletion database/seeders/FakeDataSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ class FakeDataSeeder extends Seeder
*/
public function run(): void
{
User::factory(10)->create();
(new DatabaseSeeder)->run();
User::factory(10)->create();
(new AttendanceSeeder)->run();
}
}

0 comments on commit cef76a3

Please sign in to comment.