Commit awal: prototipe UI SIAKAD Untan

This commit is contained in:
Ariyutta
2026-10-24 11:45:32 +07:00
commit d9b9cb5c0f
477 changed files with 51958 additions and 0 deletions
+79
View File
@@ -0,0 +1,79 @@
<?php
namespace Database\Factories;
use App\Enums\Role;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;
/**
* @extends Factory<User>
*/
class UserFactory extends Factory
{
/**
* The current password being used by the factory.
*/
protected static ?string $password;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'name' => fake()->name(),
'username' => fake()->unique()->userName(),
'email' => fake()->unique()->safeEmail(),
'email_verified_at' => now(),
'password' => static::$password ??= Hash::make('password'),
'role' => Role::Mahasiswa,
'is_active' => true,
'last_login_at' => null,
'remember_token' => Str::random(10),
];
}
public function superuser(): static
{
return $this->state(['role' => Role::Superuser]);
}
public function admin(): static
{
return $this->state(['role' => Role::Admin]);
}
public function operator(): static
{
return $this->state(['role' => Role::Operator]);
}
public function dosen(): static
{
return $this->state(['role' => Role::Dosen]);
}
public function mahasiswa(): static
{
return $this->state(['role' => Role::Mahasiswa]);
}
/** Akun dinonaktifkan: tidak boleh masuk. */
public function inactive(): static
{
return $this->state(['is_active' => false]);
}
/**
* Indicate that the model's email address should be unverified.
*/
public function unverified(): static
{
return $this->state(['email_verified_at' => null]);
}
}