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
+1
View File
@@ -0,0 +1 @@
*.sqlite*
+26
View File
@@ -0,0 +1,26 @@
<?php
namespace Database\Factories\Admin;
use App\Models\Admin\Admin;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<Admin>
*/
class AdminFactory extends Factory
{
protected $model = Admin::class;
/** @return array<string, mixed> */
public function definition(): array
{
return [
'user_id' => User::factory()->admin(),
'nip' => fake()->unique()->numerify('##################'),
'jabatan' => 'Administrator Akademik',
'unit_kerja' => 'Biro Akademik dan Kemahasiswaan',
];
}
}
+26
View File
@@ -0,0 +1,26 @@
<?php
namespace Database\Factories\Dosen;
use App\Models\Dosen\Dosen;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<Dosen>
*/
class DosenFactory extends Factory
{
protected $model = Dosen::class;
/** @return array<string, mixed> */
public function definition(): array
{
return [
'user_id' => User::factory()->dosen(),
'nidn' => fake()->unique()->numerify('00########'),
'nip' => fake()->unique()->numerify('##################'),
'jabatan_fungsional' => fake()->randomElement(['Asisten Ahli', 'Lektor', 'Lektor Kepala', 'Guru Besar']),
];
}
}
@@ -0,0 +1,26 @@
<?php
namespace Database\Factories\Mahasiswa;
use App\Models\Mahasiswa\Mahasiswa;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<Mahasiswa>
*/
class MahasiswaFactory extends Factory
{
protected $model = Mahasiswa::class;
/** @return array<string, mixed> */
public function definition(): array
{
return [
'user_id' => User::factory()->mahasiswa(),
'nim' => fake()->unique()->numerify('D1041#####'),
'angkatan' => fake()->numberBetween(2019, 2025),
'status' => 'aktif',
];
}
}
@@ -0,0 +1,26 @@
<?php
namespace Database\Factories\Operator;
use App\Models\Operator\Operator;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<Operator>
*/
class OperatorFactory extends Factory
{
protected $model = Operator::class;
/** @return array<string, mixed> */
public function definition(): array
{
return [
'user_id' => User::factory()->operator(),
'nip' => fake()->unique()->numerify('##################'),
'jabatan' => 'Operator Program Studi',
'unit_kerja' => 'Fakultas Teknik',
];
}
}
@@ -0,0 +1,26 @@
<?php
namespace Database\Factories\Superuser;
use App\Models\Superuser\Superuser;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<Superuser>
*/
class SuperuserFactory extends Factory
{
protected $model = Superuser::class;
/** @return array<string, mixed> */
public function definition(): array
{
return [
'user_id' => User::factory()->superuser(),
'nip' => fake()->unique()->numerify('##################'),
'jabatan' => 'Administrator Sistem',
'unit_kerja' => 'Pusat Data dan Teknologi Informasi',
];
}
}
+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]);
}
}
@@ -0,0 +1,53 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('username')->unique();
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->string('role')->index();
$table->boolean('is_active')->default(true);
$table->timestamp('last_login_at')->nullable();
$table->rememberToken();
$table->timestamps();
});
Schema::create('password_reset_tokens', function (Blueprint $table) {
$table->string('email')->primary();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
Schema::create('sessions', function (Blueprint $table) {
$table->string('id')->primary();
$table->foreignId('user_id')->nullable()->index();
$table->string('ip_address', 45)->nullable();
$table->text('user_agent')->nullable();
$table->longText('payload');
$table->integer('last_activity')->index();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('users');
Schema::dropIfExists('password_reset_tokens');
Schema::dropIfExists('sessions');
}
};
@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('cache', function (Blueprint $table) {
$table->string('key')->primary();
$table->mediumText('value');
$table->bigInteger('expiration')->index();
});
Schema::create('cache_locks', function (Blueprint $table) {
$table->string('key')->primary();
$table->string('owner');
$table->bigInteger('expiration')->index();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('cache');
Schema::dropIfExists('cache_locks');
}
};
@@ -0,0 +1,59 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('jobs', function (Blueprint $table) {
$table->id();
$table->string('queue')->index();
$table->longText('payload');
$table->unsignedSmallInteger('attempts');
$table->unsignedInteger('reserved_at')->nullable();
$table->unsignedInteger('available_at');
$table->unsignedInteger('created_at');
});
Schema::create('job_batches', function (Blueprint $table) {
$table->string('id')->primary();
$table->string('name');
$table->integer('total_jobs');
$table->integer('pending_jobs');
$table->integer('failed_jobs');
$table->longText('failed_job_ids');
$table->mediumText('options')->nullable();
$table->integer('cancelled_at')->nullable();
$table->integer('created_at');
$table->integer('finished_at')->nullable();
});
Schema::create('failed_jobs', function (Blueprint $table) {
$table->id();
$table->string('uuid')->unique();
$table->string('connection');
$table->string('queue');
$table->longText('payload');
$table->longText('exception');
$table->timestamp('failed_at')->useCurrent();
$table->index(['connection', 'queue', 'failed_at']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('jobs');
Schema::dropIfExists('job_batches');
Schema::dropIfExists('failed_jobs');
}
};
@@ -0,0 +1,25 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('profil_superuser', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->unique()->constrained()->cascadeOnDelete();
$table->string('nip')->nullable()->unique();
$table->string('jabatan')->nullable();
$table->string('unit_kerja')->nullable();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('profil_superuser');
}
};
@@ -0,0 +1,25 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('profil_admin', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->unique()->constrained()->cascadeOnDelete();
$table->string('nip')->nullable()->unique();
$table->string('jabatan')->nullable();
$table->string('unit_kerja')->nullable();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('profil_admin');
}
};
@@ -0,0 +1,25 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('profil_operator', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->unique()->constrained()->cascadeOnDelete();
$table->string('nip')->nullable()->unique();
$table->string('jabatan')->nullable();
$table->string('unit_kerja')->nullable();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('profil_operator');
}
};
@@ -0,0 +1,25 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('profil_dosen', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->unique()->constrained()->cascadeOnDelete();
$table->string('nidn')->nullable()->unique();
$table->string('nip')->nullable()->unique();
$table->string('jabatan_fungsional')->nullable();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('profil_dosen');
}
};
@@ -0,0 +1,25 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('profil_mahasiswa', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->unique()->constrained()->cascadeOnDelete();
$table->string('nim')->unique();
$table->unsignedSmallInteger('angkatan');
$table->string('status')->default('aktif');
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('profil_mahasiswa');
}
};
+34
View File
@@ -0,0 +1,34 @@
<?php
namespace Database\Seeders;
use Database\Seeders\Roles\AdminSeeder;
use Database\Seeders\Roles\DosenSeeder;
use Database\Seeders\Roles\MahasiswaSeeder;
use Database\Seeders\Roles\OperatorSeeder;
use Database\Seeders\Roles\SuperuserSeeder;
use Illuminate\Database\Seeder;
class DatabaseSeeder extends Seeder
{
/**
* Seed the application's database.
*/
public function run(): void
{
// Akun demo berkata sandi "password" tidak boleh ada di produksi.
if (app()->isProduction()) {
$this->command?->warn('Seeder akun demo dilewati di lingkungan production.');
return;
}
$this->call([
SuperuserSeeder::class,
AdminSeeder::class,
OperatorSeeder::class,
DosenSeeder::class,
MahasiswaSeeder::class,
]);
}
}
+36
View File
@@ -0,0 +1,36 @@
<?php
namespace Database\Seeders\Roles;
use App\Enums\Role;
use App\Models\Admin\Admin;
use App\Models\User;
use Illuminate\Database\Seeder;
class AdminSeeder extends Seeder
{
public function run(): void
{
// Unguarded: kolom `role` sengaja tidak mass-assignable.
$user = User::unguarded(fn (): User => User::updateOrCreate(
['username' => 'admin'],
[
'name' => 'Siti Nurhaliza, S.Kom.',
'email' => 'admin@siakad-untan.test',
'password' => 'password',
'role' => Role::Admin,
'is_active' => true,
'email_verified_at' => now(),
],
));
Admin::updateOrCreate(
['user_id' => $user->id],
[
'nip' => '198005222005012003',
'jabatan' => 'Administrator Akademik',
'unit_kerja' => 'Biro Akademik dan Kemahasiswaan',
],
);
}
}
+36
View File
@@ -0,0 +1,36 @@
<?php
namespace Database\Seeders\Roles;
use App\Enums\Role;
use App\Models\Dosen\Dosen;
use App\Models\User;
use Illuminate\Database\Seeder;
class DosenSeeder extends Seeder
{
public function run(): void
{
// Unguarded: kolom `role` sengaja tidak mass-assignable.
$user = User::unguarded(fn (): User => User::updateOrCreate(
['username' => 'dosen'],
[
'name' => 'Dr. Rina Kartika Sari, M.Si.',
'email' => 'dosen@siakad-untan.test',
'password' => 'password',
'role' => Role::Dosen,
'is_active' => true,
'email_verified_at' => now(),
],
));
Dosen::updateOrCreate(
['user_id' => $user->id],
[
'nidn' => '0012058701',
'nip' => '198705122014042001',
'jabatan_fungsional' => 'Lektor Kepala',
],
);
}
}
@@ -0,0 +1,36 @@
<?php
namespace Database\Seeders\Roles;
use App\Enums\Role;
use App\Models\Mahasiswa\Mahasiswa;
use App\Models\User;
use Illuminate\Database\Seeder;
class MahasiswaSeeder extends Seeder
{
public function run(): void
{
// Unguarded: kolom `role` sengaja tidak mass-assignable.
$user = User::unguarded(fn (): User => User::updateOrCreate(
['username' => 'mahasiswa'],
[
'name' => 'Muhammad Rizky Ramadhan',
'email' => 'mahasiswa@siakad-untan.test',
'password' => 'password',
'role' => Role::Mahasiswa,
'is_active' => true,
'email_verified_at' => now(),
],
));
Mahasiswa::updateOrCreate(
['user_id' => $user->id],
[
'nim' => 'D1041211001',
'angkatan' => 2021,
'status' => 'aktif',
],
);
}
}
+36
View File
@@ -0,0 +1,36 @@
<?php
namespace Database\Seeders\Roles;
use App\Enums\Role;
use App\Models\Operator\Operator;
use App\Models\User;
use Illuminate\Database\Seeder;
class OperatorSeeder extends Seeder
{
public function run(): void
{
// Unguarded: kolom `role` sengaja tidak mass-assignable.
$user = User::unguarded(fn (): User => User::updateOrCreate(
['username' => 'operator'],
[
'name' => 'Andi Pratama, S.Kom.',
'email' => 'operator@siakad-untan.test',
'password' => 'password',
'role' => Role::Operator,
'is_active' => true,
'email_verified_at' => now(),
],
));
Operator::updateOrCreate(
['user_id' => $user->id],
[
'nip' => '199011102019031004',
'jabatan' => 'Operator Program Studi',
'unit_kerja' => 'Fakultas Teknik',
],
);
}
}
@@ -0,0 +1,36 @@
<?php
namespace Database\Seeders\Roles;
use App\Enums\Role;
use App\Models\Superuser\Superuser;
use App\Models\User;
use Illuminate\Database\Seeder;
class SuperuserSeeder extends Seeder
{
public function run(): void
{
// Unguarded: kolom `role` sengaja tidak mass-assignable.
$user = User::unguarded(fn (): User => User::updateOrCreate(
['username' => 'superuser'],
[
'name' => 'Ir. Budi Santoso, M.T.',
'email' => 'superuser@siakad-untan.test',
'password' => 'password',
'role' => Role::Superuser,
'is_active' => true,
'email_verified_at' => now(),
],
));
Superuser::updateOrCreate(
['user_id' => $user->id],
[
'nip' => '197203151998031002',
'jabatan' => 'Administrator Sistem',
'unit_kerja' => 'Pusat Data dan Teknologi Informasi',
],
);
}
}