This commit is contained in:
tanskwacu 2025-06-24 13:54:21 +07:00
parent 3edb24aa16
commit f7bffa9c4c
194 changed files with 21400 additions and 0 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

18
.editorconfig Normal file
View File

@ -0,0 +1,18 @@
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false
[*.{yml,yaml}]
indent_size = 2
[docker-compose.yml]
indent_size = 4

65
.env.example Normal file
View File

@ -0,0 +1,65 @@
APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:w2Qji30DMVBe1Ups7tdkQX+DBKyCi5JlQsdTyBopddA=
APP_DEBUG=true
APP_URL=http://localhost
APP_LOCALE=en
APP_FALLBACK_LOCALE=en
APP_FAKER_LOCALE=en_US
APP_MAINTENANCE_DRIVER=file
# APP_MAINTENANCE_STORE=database
PHP_CLI_SERVER_WORKERS=4
BCRYPT_ROUNDS=12
LOG_CHANNEL=stack
LOG_STACK=single
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=new_pilmapres
DB_USERNAME=root
DB_PASSWORD=
SESSION_DRIVER=database
SESSION_LIFETIME=120
SESSION_ENCRYPT=false
SESSION_PATH=/
SESSION_DOMAIN=null
BROADCAST_CONNECTION=log
FILESYSTEM_DISK=local
QUEUE_CONNECTION=database
CACHE_STORE=database
# CACHE_PREFIX=
MEMCACHED_HOST=127.0.0.1
REDIS_CLIENT=phpredis
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER=log
MAIL_SCHEME=null
MAIL_HOST=127.0.0.1
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}"
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false
VITE_APP_NAME="${APP_NAME}"

11
.gitattributes vendored Normal file
View File

@ -0,0 +1,11 @@
* text=auto eol=lf
*.blade.php diff=html
*.css diff=css
*.html diff=html
*.md diff=markdown
*.php diff=php
/.github export-ignore
CHANGELOG.md export-ignore
.styleci.yml export-ignore

23
.gitignore vendored Normal file
View File

@ -0,0 +1,23 @@
/.phpunit.cache
/node_modules
/public/build
/public/hot
/public/storage
/storage/*.key
/storage/pail
/vendor
.env
.env.backup
.env.production
.phpactor.json
.phpunit.result.cache
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
/auth.json
/.fleet
/.idea
/.nova
/.vscode
/.zed

View File

@ -0,0 +1,29 @@
<?php
namespace App\Exports;
use App\Models\RekapPenilaianTahunan;
use Illuminate\Contracts\View\View;
use Maatwebsite\Excel\Concerns\FromView;
class RekapTahunanExport implements FromView
{
protected $tahun;
public function __construct($tahun)
{
$this->tahun = $tahun;
}
public function view(): View
{
return view('exports.rekap_tahunan', [
'rekap' => RekapPenilaianTahunan::with('peserta.user')
->where('tahun', $this->tahun)
->orderByDesc('total_akhir')
->get(),
'tahun' => $this->tahun,
]);
}
}

View File

@ -0,0 +1,64 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Models\BidangCu;
use Illuminate\Http\Request;
class BidangCuController extends Controller
{
/**
* Tampilkan halaman index (dengan modal create/edit).
*/
public function index()
{
$bidangs = BidangCu::orderBy('id')->get();
return view('admin.bidang', compact('bidangs'));
}
/**
* Simpan bidang baru.
*/
public function store(Request $request)
{
$request->validate([
'nama' => 'required|string|max:50',
]);
BidangCu::create([
'nama' => $request->nama,
]);
return redirect()->route('admin.bidang-cu.index')
->with('success', 'Bidang CU berhasil ditambahkan.');
}
/**
* Update data bidang.
*/
public function update(Request $request, BidangCu $bidangCu)
{
$request->validate([
'nama' => 'required|string|max:50',
]);
$bidangCu->update([
'nama' => $request->nama,
]);
return redirect()->route('admin.bidang-cu.index')
->with('success', 'Bidang CU berhasil diperbarui.');
}
/**
* Hapus bidang.
*/
public function destroy(BidangCu $bidangCu)
{
$bidangCu->delete();
return redirect()->route('admin.bidang-cu.index')
->with('success', 'Bidang CU berhasil dihapus.');
}
}

View File

@ -0,0 +1,60 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Models\BobotKriteria;
use Illuminate\Http\Request;
class BobotKriteriaController extends Controller
{
public function __construct()
{
$this->middleware('auth');
}
/**
* Tampilkan halaman index (dengan modal Tambah/Edit).
*/
public function index()
{
// Ambil semua data
$items = BobotKriteria::all();
// Pastikan nama view sesuai: resources/views/admin/bobot-kriteria/index.blade.php
return view('admin.bobot', compact('items'));
}
/**
* Simpan bobot baru.
*/
public function store(Request $request)
{
$request->validate([
'nama_kriteria' => 'required|in:CU,PI,BI|unique:bobot_kriteria,nama_kriteria',
'bobot' => 'required|numeric|between:0,1',
]);
BobotKriteria::create($request->only('nama_kriteria','bobot'));
return redirect()
->route('admin.bobot-kriteria.index')
->with('success', 'Bobot kriteria berhasil ditambahkan.');
}
/**
* Update bobot (dipanggil via PUT dari modal).
*/
public function update(Request $request, $nama)
{
$request->validate([
'bobot' => 'required|numeric|between:0,1',
]);
$item = BobotKriteria::findOrFail($nama);
$item->update(['bobot' => $request->bobot]);
return redirect()
->route('admin.bobot-kriteria.index')
->with('success', 'Bobot kriteria berhasil diperbarui.');
}
}

View File

@ -0,0 +1,97 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Models\CuSelection;
use App\Models\CuSubmission;
use App\Models\KategoriCu;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class CuSelectionController extends Controller
{
public function index()
{
$selections = CuSelection::select([
'peserta_id',
DB::raw('SUM(skor_cu) AS total_skor_cu'),
DB::raw('ROUND(SUM(skor_cu)/10,4) AS avg_skor_cu'),
DB::raw("(SELECT cs2.status_lolos
FROM cu_selection cs2
WHERE cs2.peserta_id = cu_selection.peserta_id
AND cs2.selection_round = 1
ORDER BY cs2.selected_at DESC
LIMIT 1) AS status_lolos"),
DB::raw("(SELECT cs3.selected_at
FROM cu_selection cs3
WHERE cs3.peserta_id = cu_selection.peserta_id
AND cs3.selection_round = 1
ORDER BY cs3.selected_at DESC
LIMIT 1) AS selected_at"),
])
->where('selection_round', 1)
->groupBy('peserta_id')
->with('peserta.user')
->orderByDesc('avg_skor_cu')
->get();
return view('admin.selection', compact('selections'));
}
public function showDetail($pesertaId)
{
// Ambil semua CU yang sudah approved dan eager load kategori + bidang-nya
$submissions = CuSubmission::with(['kategori', 'kategori.bidang'])
->where('peserta_id', $pesertaId)
->where('status', CuSubmission::STATUS_APPROVED)
->get();
// Group per bidang & pilih top-4 per bidang
$byBidang = $submissions->groupBy(fn($item) => $item->kategori->bidang_id);
$pool = collect();
foreach ($byBidang as $group) {
$pool = $pool->merge($group->sortByDesc('skor')->take(4));
}
// Top-10 overall
$finalSelectedCUs = $pool->sortByDesc('skor')->take(10)->values();
// Hitung total skor dan maksimal per hitungan SAW
$totalSkorCU = $finalSelectedCUs->sum('skor');
$maxPerBidang = KategoriCu::groupBy('bidang_id')
->select('bidang_id', DB::raw('MAX(skor) AS max_skor'))
->pluck('max_skor', 'bidang_id');
$maxSkorCU = $byBidang->reduce(function ($carry, $group) use ($maxPerBidang) {
$bidangId = $group->first()->kategori->bidang_id;
$count = min(4, $group->count());
return $carry + ($maxPerBidang[$bidangId] ?? 0) * $count;
}, 0);
$norm = $maxSkorCU > 0 ? round($totalSkorCU / $maxSkorCU, 4) : 0;
if (request()->ajax()) {
// Partial di folder admin/partials/selection_detail.blade.php
return view('admin.layouts.partials.selection_detail', compact(
'finalSelectedCUs', 'totalSkorCU', 'maxSkorCU', 'norm'
));
}
return redirect()->route('admin.cu_selection.index');
}
public function updateStatus(Request $request, $pesertaId)
{
$request->validate([ 'status_lolos' => 'required|in:lolos,gagal' ]);
CuSelection::where('peserta_id', $pesertaId)
->where('selection_round', 1)
->update([
'status_lolos' => $request->status_lolos,
'selected_at' => now(),
]);
return back()->with('success', 'Status peserta berhasil diperbarui.');
}
}

View File

@ -0,0 +1,151 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Models\CuSubmission;
use App\Models\PenilaianAkhir;
use App\Models\CuSelection;
use App\Models\KategoriCu;
use App\Models\BobotKriteria;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class CuVerificationController extends Controller
{
public function index()
{
// Ringkasan CU yang sudah disetujui
$rows = DB::table('cu_submission as cs')
->join('kategori_cu as kc', 'cs.kategori_cu_id', '=', 'kc.id')
->join('peserta_profile as pp', 'cs.peserta_id', '=', 'pp.user_id')
->join('users as u', 'pp.user_id', '=', 'u.id')
->where('cs.status', CuSubmission::STATUS_APPROVED)
->select(
'cs.peserta_id',
'u.name',
DB::raw('COALESCE(SUM(CASE WHEN kc.bidang_id = 1 THEN cs.skor END),0) AS Kompetisi'),
DB::raw('COALESCE(SUM(CASE WHEN kc.bidang_id = 2 THEN cs.skor END),0) AS Pengakuan'),
DB::raw('COALESCE(SUM(CASE WHEN kc.bidang_id = 3 THEN cs.skor END),0) AS Penghargaan'),
DB::raw('COALESCE(SUM(CASE WHEN kc.bidang_id = 4 THEN cs.skor END),0) AS Karir_Organisasi'),
DB::raw('COALESCE(SUM(CASE WHEN kc.bidang_id = 5 THEN cs.skor END),0) AS Hasil_Karya'),
DB::raw('COALESCE(SUM(CASE WHEN kc.bidang_id = 6 THEN cs.skor END),0) AS PAK'),
DB::raw('COALESCE(SUM(CASE WHEN kc.bidang_id = 7 THEN cs.skor END),0) AS Kewirausahaan'),
DB::raw('SUM(cs.skor) AS total_mentah')
)
->groupBy('cs.peserta_id', 'u.name')
->get();
$maxRaw = $rows->max('total_mentah') ?: 1;
// Transformasi: sertakan semua bidang agar Blade dapat mengakses properti
$rows->transform(function ($r) use ($maxRaw) {
return (object) [
'peserta_id' => $r->peserta_id,
'name' => $r->name,
'Kompetisi' => $r->Kompetisi,
'Pengakuan' => $r->Pengakuan,
'Penghargaan' => $r->Penghargaan,
'Karir_Organisasi' => $r->Karir_Organisasi,
'Hasil_Karya' => $r->Hasil_Karya,
'PAK' => $r->PAK,
'Kewirausahaan' => $r->Kewirausahaan,
'total_mentah' => $r->total_mentah,
'normalized' => round($r->total_mentah / $maxRaw, 4),
];
});
// Ambil semua submission yang masih pending
$submissions = CuSubmission::with(['peserta', 'kategori'])
->where('status', CuSubmission::STATUS_PENDING)
->get();
return view('admin.verifikasiberkas', compact('rows', 'submissions'));
}
public function approve(CuSubmission $submission)
{
DB::transaction(function () use ($submission) {
// 1⃣ Tandai submission ini sebagai approved
$submission->update([
'status' => CuSubmission::STATUS_APPROVED,
'reviewed_at' => now(),
]);
// 2⃣ Kumpulkan semua CU yang sudah approved untuk peserta ini
$approved = CuSubmission::with('kategori')
->where('peserta_id', $submission->peserta_id)
->where('status', CuSubmission::STATUS_APPROVED)
->get();
// 3⃣ Ambil top 4 per bidang, lalu dari hasilnya ambil top 10 overall
$byBidang = $approved->groupBy(fn($item) => $item->kategori->bidang_id);
$selected = collect();
foreach ($byBidang as $group) {
$selected = $selected->merge($group->sortByDesc('skor')->take(4));
}
$final = $selected->sortByDesc('skor')->take(10);
// 4⃣ Hitung total skor mentah dari CU yang terpilih
$sumSkor = $final->sum('skor');
// 5⃣ Cari nilai tertinggi dari semua peserta (untuk normalisasi global)
$maxTotalSkor = CuSubmission::where('status', CuSubmission::STATUS_APPROVED)
->groupBy('peserta_id')
->selectRaw('SUM(skor) as total')
->orderByDesc('total')
->value('total') ?: 1;
// 6⃣ Hitung skor CU yang sudah dinormalisasi (maksimal = 1)
$normCu = round($sumSkor / $maxTotalSkor, 4);
// 7⃣ Ambil bobot kriteria untuk CU
$bobot = BobotKriteria::pluck('bobot', 'nama_kriteria');
$bCu = $bobot['CU'] ?? 0;
// 8⃣ Simpan/Update ke penilaian_akhir (PI & BI = 0 dulu)
PenilaianAkhir::updateOrCreate(
['peserta_id' => $submission->peserta_id],
[
'skor_cu_normal' => $normCu,
'skor_pi_normal' => 0.0000,
'skor_bi_normal' => 0.0000,
'total_akhir' => round($normCu * $bCu, 4),
]
);
// 9⃣ Buat record di cu_selection (pakai skor normalisasi)
CuSelection::create([
'submission_id' => $submission->id,
'peserta_id' => $submission->peserta_id,
'level_id' => $submission->kategori->level_id,
'selection_round' => 1,
'status_lolos' => 'pending',
'skor_cu' => $normCu,
'selected_at' => now(),
]);
});
return redirect()->route('admin.verification.index')
->with('success', 'Submission CU berhasil disetujui.');
}
public function reject(Request $request, CuSubmission $submission)
{
$request->validate([
'comment' => 'required|string',
]);
$submission->status = CuSubmission::STATUS_REJECTED;
$submission->comment = $request->comment;
$submission->reviewed_at = now();
$submission->save();
// ✅ Redirect untuk mencegah browser mengulang GET ke URL POST
return redirect()->route('admin.verification.index')->with('success', 'Submission berhasil ditolak.');
}
}

View File

@ -0,0 +1,56 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\User;
use App\Models\CuSubmission;
use App\Models\PenilaianAkhir;
class DashboardController extends Controller
{
public function index()
{
// Total peserta
$totalPeserta = User::where('role', 'peserta')->count();
// Total berkas (all submissions)
$totalBerkas = CuSubmission::count();
// Pending berkas count
$pendingBerkas = CuSubmission::where('status', 'pending')->count();
// Latest 5 submissions with peserta relation
$latestSubmissions = CuSubmission::with('peserta.user')
->orderBy('submitted_at', 'desc')
->take(5)
->get();
// Top 3 winners by final total score (hanya yang sudah memiliki skor PI & BI)
$winners = PenilaianAkhir::with('peserta.user')
// hanya yang skor PI > 0
->where('skor_pi_normal', '>', 0)
// dan skor BI > 0
->where('skor_bi_normal', '>', 0)
->orderBy('total_akhir', 'desc')
->take(3)
->get();
return view('admin.dashboard', compact(
'totalPeserta',
'totalBerkas',
'pendingBerkas',
'latestSubmissions',
'winners'
));
}
public function destroySubmission($id)
{
$submission = CuSubmission::findOrFail($id);
$submission->delete();
return redirect()
->route('admin.dashboard')
->with('success', 'Berkas CU berhasil dihapus.');
}
}

View File

@ -0,0 +1,72 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Models\KategoriCu;
use App\Models\BidangCu;
use App\Models\LevelCu;
use Illuminate\Http\Request;
class KategoriCuController extends Controller
{
public function index()
{
$bidangs = BidangCu::orderBy('nama')->get();
$levels = LevelCu::orderBy('level')->get();
$kategoris = KategoriCu::with(['bidang','level'])
->orderBy('bidang_id')
->orderBy('wujud_cu')
->get();
return view('admin.kategori', compact('bidangs','levels','kategoris'));
}
public function store(Request $request)
{
$request->validate([
'bidang_id' => 'required|exists:bidang_cu,id',
'wujud_cu' => 'required|string|max:100',
'kode' => 'required|string|max:4',
'level_id' => 'required|exists:level_cu,level',
'skor' => 'required|numeric|min:0',
]);
KategoriCu::create($request->only('bidang_id','wujud_cu','kode','level_id','skor'));
return redirect()->route('admin.kategori-cu.index')
->with('success','Kategori CU berhasil ditambahkan.');
}
public function update(Request $request, KategoriCu $kategoriCu)
{
$request->validate([
'bidang_id' => 'required|exists:bidang_cu,id', // jika Anda juga ingin memperbolehkan ubah bidang
'level_id' => 'required|exists:level_cu,level', // tambahkan ini
'wujud_cu' => 'required|string|max:100',
'kode' => 'required|string|max:4',
'skor' => 'required|numeric|min:0',
]);
$kategoriCu->update($request->only(
'bidang_id', // jika diizinkan
'level_id', // sekarang ikut terupdate
'wujud_cu',
'kode',
'skor'
));
return redirect()->route('admin.kategori-cu.index')
->with('success','Kategori CU berhasil diperbarui.');
}
public function destroy(KategoriCu $kategoriCu)
{
$kategoriCu->delete();
return redirect()->route('admin.kategori-cu.index')
->with('success','Kategori CU berhasil dihapus.');
}
}

View File

@ -0,0 +1,198 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Models\HeroSlide;
use App\Models\HeroFeature;
use App\Models\Purpose;
use App\Models\Requirement;
use App\Models\Schedule;
use Illuminate\Http\Request;
class LandingPageController extends Controller
{
public function index(Request $request)
{
$search = $request->search;
$heroSlides = HeroSlide::query()
->when($search, fn($q) => $q->where('title', 'like', "%$search%"))
->orderBy('order')
->paginate(10);
$purposes = Purpose::query()
->when($search, fn($q) => $q->where('title', 'like', "%$search%"))
->orderBy('order')
->paginate(10);
$requirements = Requirement::query()
->orderBy('order')
->paginate(10);
$schedules = Schedule::query()
->orderBy('order')
->paginate(10);
return view('admin.landing-page.index', compact('heroSlides', 'purposes', 'requirements', 'schedules'));
}
// Hero Slide Methods
public function storeHeroSlide(Request $request)
{
$data = $request->validate([
'title' => 'required|string',
'subtitle' => 'nullable|string',
'image_path' => 'nullable|image|max:2048',
'button_text' => 'nullable|string',
'button_url' => 'nullable|string',
'order' => 'nullable|integer',
]);
if ($request->hasFile('image_path')) {
$data['image_path'] = $request->file('image_path')->store('hero_slides', 'public');
}
HeroSlide::create($data);
return back()->with('success', 'Hero Slide berhasil ditambahkan.');
}
public function updateHeroSlide(Request $request, HeroSlide $heroSlide)
{
$data = $request->validate([
'title' => 'required|string',
'subtitle' => 'nullable|string',
'image_path' => 'nullable|image|max:2048',
'button_text' => 'nullable|string',
'button_url' => 'nullable|string',
'order' => 'nullable|integer',
]);
if ($request->hasFile('image_path')) {
$data['image_path'] = $request->file('image_path')->store('hero_slides', 'public');
}
$heroSlide->update($data);
return back()->with('success', 'Hero Slide berhasil diupdate.');
}
public function destroyHeroSlide(HeroSlide $heroSlide)
{
$heroSlide->delete();
return back()->with('success', 'Hero Slide berhasil dihapus.');
}
// Purpose Methods
public function storePurpose(Request $request)
{
$data = $request->validate([
'title' => 'required|string',
'description' => 'required|string', // ← tambahkan ini
'icon_path' => 'nullable|image|max:2048',
'order' => 'nullable|integer',
]);
if ($request->hasFile('icon_path')) {
$data['icon_path'] = $request->file('icon_path')
->store('purposes','public');
}
Purpose::create($data);
return back()->with('success','Purpose berhasil ditambahkan.');
}
public function updatePurpose(Request $request, Purpose $purpose)
{
$data = $request->validate([
'title' => 'required|string',
'description' => 'required|string',
'icon_path' => 'nullable|image|max:2048',
'order' => 'nullable|integer',
]);
if($request->hasFile('icon_path')){
$data['icon_path'] = $request->file('icon_path')->store('purposes','public');
}
$purpose->update($data);
return back()->with('success','Purpose berhasil diupdate.');
}
public function destroyPurpose(Purpose $purpose)
{
$purpose->delete();
return back()->with('success', 'Purpose berhasil dihapus.');
}
// Requirement Methods
public function storeRequirement(Request $request)
{
$data = $request->validate([
'text' => 'required|string',
'order' => 'nullable|integer',
]);
Requirement::create($data);
return back()->with('success', 'Requirement berhasil ditambahkan.');
}
public function updateRequirement(Request $request, Requirement $requirement)
{
$data = $request->validate([
'text' => 'required|string',
'order' => 'nullable|integer',
]);
$requirement->update($data);
return back()->with('success', 'Requirement berhasil diupdate.');
}
public function destroyRequirement(Requirement $requirement)
{
$requirement->delete();
return back()->with('success', 'Requirement berhasil dihapus.');
}
// Schedule Methods
public function storeSchedule(Request $request)
{
$data = $request->validate([
'activity' => 'required|string',
'date_from' => 'required|date',
'date_to' => 'required|date',
'order' => 'nullable|integer',
]);
Schedule::create($data);
return back()->with('success', 'Schedule berhasil ditambahkan.');
}
public function updateSchedule(Request $request, Schedule $schedule)
{
$data = $request->validate([
'activity' => 'required|string',
'date_from' => 'required|date',
'date_to' => 'required|date',
'order' => 'nullable|integer',
]);
$schedule->update($data);
return back()->with('success', 'Schedule berhasil diupdate.');
}
public function destroySchedule(Schedule $schedule)
{
$schedule->delete();
return back()->with('success', 'Schedule berhasil dihapus.');
}
}

View File

@ -0,0 +1,62 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Models\LevelCu;
use Illuminate\Http\Request;
class LevelCuController extends Controller
{
/**
* Tampilkan daftar level.
*/
public function index()
{
$levels = LevelCu::orderBy('level')->get();
return view('admin.level', compact('levels'));
}
/**
* Simpan level baru.
*/
public function store(Request $request)
{
$request->validate([
'level' => 'required|string|size:1|unique:level_cu,level',
'description' => 'required|string|max:50',
]);
LevelCu::create($request->only('level','description'));
return redirect()->route('admin.level-cu.index')
->with('success','Level CU berhasil ditambahkan.');
}
/**
* Update level.
*/
public function update(Request $request, $level)
{
$request->validate([
'description' => 'required|string|max:50',
]);
$lc = LevelCu::findOrFail($level);
$lc->update(['description' => $request->description]);
return redirect()->route('admin.level-cu.index')
->with('success','Level CU berhasil diperbarui.');
}
/**
* Hapus level.
*/
public function destroy($level)
{
LevelCu::findOrFail($level)->delete();
return redirect()->route('admin.level-cu.index')
->with('success','Level CU berhasil dihapus.');
}
}

View File

@ -0,0 +1,81 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Validation\Rule;
use Hash;
class ManajemenAkunController extends Controller
{
public function index()
{
// eager load semua profile agar tidak N+1
$users = User::with(['adminProfile','juriProfile','pesertaProfile'])
->orderBy('role')
->orderBy('name')
->paginate(15);
return view('admin.manajemenakun.index', compact('users'));
}
public function create()
{
return view('admin.manajemenakun.create');
}
public function store(Request $request)
{
$data = $request->validate([
'name' => 'required|string|max:100',
'email' => 'required|email|unique:users',
'password' => 'required|confirmed|min:6',
'role' => ['required', Rule::in(['admin','juri','peserta'])],
]);
$data['password'] = Hash::make($data['password']);
$user = User::create($data);
// (Opsional) Buat record profile kosong sesuai role
// misal: AdminProfile::create(['user_id'=>$user->id]);
return redirect()->route('admin.manajemen-akun.index')
->with('success','Akun berhasil dibuat.');
}
public function edit(User $manajemenAkun)
{
return view('admin.manajemenakun.edit', [
'user' => $manajemenAkun
]);
}
public function update(Request $request, User $manajemenAkun)
{
$data = $request->validate([
'name' => 'required|string|max:100',
'email' => ['required','email', Rule::unique('users')->ignore($manajemenAkun->id)],
'password' => 'nullable|confirmed|min:6',
'role' => ['required', Rule::in(['admin','juri','peserta'])],
]);
if ($data['password'] ?? false) {
$data['password'] = Hash::make($data['password']);
} else {
unset($data['password']);
}
$manajemenAkun->update($data);
return redirect()->route('admin.manajemen-akun.index')
->with('success','Akun berhasil diperbarui.');
}
public function destroy(User $manajemenAkun)
{
$manajemenAkun->delete();
return back()->with('success','Akun berhasil dihapus.');
}
}

View File

@ -0,0 +1,194 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Models\CuSubmission;
use App\Models\PenilaianAkhir;
use App\Models\PesertaProfile;
use App\Models\PenilaianPiJuri;
use App\Models\PenilaianBiJuri;
use App\Models\BobotKriteria;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class PenilaianAkhirController extends Controller
{
public function __construct()
{
$this->middleware('auth');
}
/**
* Tampilkan daftar perangkingan peserta berdasarkan SAW dengan normalisasi CU "fresh",
* namun mempertahankan nilai PI & BI yang sudah tersimpan.
*/
public function index()
{
// 1. Ambil bobot kriteria
$bobot = BobotKriteria::all()->pluck('bobot', 'nama_kriteria')->toArray();
// 2. Hitung total_mentah dari CU untuk setiap peserta yang approved
$cuTotals = CuSubmission::query()
->where('status', CuSubmission::STATUS_APPROVED)
->select('peserta_id', DB::raw('SUM(skor) as total_mentah'))
->groupBy('peserta_id')
->get();
// 3. Cari nilai maksimal total_mentah
$maxRaw = $cuTotals->max('total_mentah') ?: 1;
// 4. Ambil profil peserta dan data PenilaianAkhir tersimpan
$pesertaIds = $cuTotals->pluck('peserta_id')->toArray();
$profiles = PesertaProfile::with('user')
->whereIn('user_id', $pesertaIds)
->get()
->keyBy('user_id');
$stored = PenilaianAkhir::whereIn('peserta_id', $pesertaIds)
->get()
->keyBy('peserta_id');
// 5. Bangun data final
$data = $cuTotals->map(function($item) use ($bobot, $maxRaw, $profiles, $stored) {
$pid = $item->peserta_id;
$profile = $profiles->get($pid);
$pa = $stored->get($pid);
// Norm CU fresh
$normCu = round($item->total_mentah / $maxRaw, 4);
// Pertahankan PI & BI dari db jika ada
$normPi = $pa?->skor_pi_normal ?? 0.0;
$normBi = $pa?->skor_bi_normal ?? 0.0;
$norm = ['CU' => $normCu, 'PI' => $normPi, 'BI' => $normBi];
$weighted = [
'CU' => round($normCu * ($bobot['CU'] ?? 0), 4),
'PI' => round($normPi * ($bobot['PI'] ?? 0), 4),
'BI' => round($normBi * ($bobot['BI'] ?? 0), 4),
];
$computed = array_sum($weighted);
return (object) [
'peserta' => $profile,
'norm' => $norm,
'weighted' => $weighted,
'computed_total' => $computed,
'rank' => 0,
];
})
->sortByDesc('computed_total')
->values();
// 6. Update tabel penilaian_akhir dan tetapkan rank perkalian nya
$data->each(function($row, $idx) use ($bobot) {
$pid = $row->peserta->user_id;
$pa = PenilaianAkhir::firstOrNew(['peserta_id' => $pid]);
$pa->skor_cu_normal = $row->norm['CU'];
$pa->skor_pi_normal = $row->norm['PI'];
$pa->skor_bi_normal = $row->norm['BI'];
$pa->total_akhir = round(
$row->norm['CU'] * ($bobot['CU'] ?? 0)
+ $row->norm['PI'] * ($bobot['PI'] ?? 0)
+ $row->norm['BI'] * ($bobot['BI'] ?? 0)
, 4);
$pa->save();
$row->rank = $idx + 1;
});
// 7. Siapkan matrix untuk view
$matrix = $data->map(function($row) {
return [
'peserta' => $row->peserta->user->name,
'norm' => $row->norm,
'weighted' => $row->weighted,
];
});
return view('admin.penilaian_akhir', [
'data' => $data,
'matrix' => $matrix,
'bobot' => $bobot,
]);
}
public function destroy($id)
{
// 1. Temukan entri PenilaianAkhir berdasarkan ID
$pa = PenilaianAkhir::findOrFail($id);
$pesertaId = $pa->peserta_id;
// 2. Hapus semua PenilaianPiJuri di mana schedule.peserta_id = $pesertaId
PenilaianPiJuri::whereHas('schedule', function($query) use ($pesertaId) {
$query->where('peserta_id', $pesertaId);
})->delete();
// 3. Hapus semua PenilaianBiJuri di mana schedule.peserta_id = $pesertaId
PenilaianBiJuri::whereHas('schedule', function($query) use ($pesertaId) {
$query->where('peserta_id', $pesertaId);
})->delete();
// 4. Hapus semua CU Submission yang sudah disetujui untuk peserta ini
CuSubmission::where('peserta_id', $pesertaId)
->where('status', CuSubmission::STATUS_APPROVED)
->delete();
// 5. Hapus entri PenilaianAkhir itu sendiri
$pa->delete();
return redirect()
->route('admin.penilaian-akhir.index')
->with('success', 'Penilaian Akhir, CU Submission, dan seluruh Penilaian PI & BI Juri berhasil dihapus.');
}
protected function simpanRekapitulasiTahunan($year = null)
{
$currentYear = $year ?? date('Y');
$penilaianList = \App\Models\PenilaianAkhir::all();
foreach ($penilaianList as $pa) {
$pid = $pa->peserta_id;
// Ambil semua entri CU untuk peserta ini
$cuList = \App\Models\CuSelection::where('peserta_id', $pid)->get();
// Default status dan round
$statusCu = 'pending';
$round = 0;
if ($cuList->isNotEmpty()) {
// Ambil selection_round tertinggi
$round = $cuList->max('selection_round');
// Cari status_lolos sesuai urutan prioritas
if ($cuList->contains('status_lolos', 'lolos')) {
$statusCu = 'lolos';
} elseif ($cuList->contains('status_lolos', 'gagal')) {
$statusCu = 'gagal';
} elseif ($cuList->contains('status_lolos', 'pending')) {
$statusCu = 'pending';
}
}
// Simpan rekap
\App\Models\RekapPenilaianTahunan::updateOrCreate(
['peserta_id' => $pid, 'tahun' => $currentYear],
[
'skor_cu_normal' => $pa->skor_cu_normal,
'skor_pi_normal' => $pa->skor_pi_normal,
'skor_bi_normal' => $pa->skor_bi_normal,
'total_akhir' => $pa->total_akhir,
'status_cu' => $statusCu,
'selection_round' => $round,
]
);
}
}
public function rekapTahunan(Request $request)
{
$this->simpanRekapitulasiTahunan();
return redirect()->route('admin.penilaian-akhir.index')
->with('success', 'Rekapitulasi tahunan berhasil disimpan.');
}
}

View File

@ -0,0 +1,31 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Models\RekapPenilaianTahunan;
class RekapTahunanController extends Controller
{
public function index()
{
// Ambil semua tahun yang tersedia dari tabel
$years = RekapPenilaianTahunan::select('tahun')
->distinct()
->orderByDesc('tahun')
->pluck('tahun');
return view('admin.rekap.index', compact('years'));
}
public function show($tahun)
{
$rekap = \App\Models\RekapPenilaianTahunan::with('peserta.user')
->where('tahun', $tahun)
->orderByDesc('total_akhir') // ✅ urut dari yang tertinggi
->get();
return view('admin.rekap.show', compact('rekap', 'tahun'));
}
}

View File

@ -0,0 +1,132 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Models\SchedulePiBi;
use App\Models\User;
use App\Models\JuriProfile;
use Illuminate\Http\Request;
use Carbon\Carbon;
class SchedulePiBiController extends Controller
{
public function index()
{
$schedules = SchedulePiBi::with(['peserta', 'juris'])
->orderBy('tanggal')
->paginate(10);
$scheduledIds = SchedulePiBi::pluck('peserta_id')->toArray();
$pesertas = User::whereHas('pesertaProfile', fn($q) =>
$q->whereHas('cuSelection', fn($q2) =>
$q2->where('selection_round', 1)
->where('status_lolos', 'lolos')
)
)
->whereNotIn('id', $scheduledIds)
->pluck('name', 'id');
$juris = User::where('role', 'juri')->pluck('name', 'id');
return view('admin.schedules', compact('schedules', 'pesertas', 'juris'));
}
public function store(Request $request)
{
$data = $request->validate([
'peserta_id' => 'required|exists:users,id',
'juri_id' => 'required|array|min:1',
'juri_id.*' => 'exists:users,id',
'tanggal' => 'required|date_format:Y-m-d\TH:i',
'lokasi' => 'required|string|max:150',
]);
// Pastikan setiap juri punya profile di juri_profile
foreach ($data['juri_id'] as $jId) {
JuriProfile::firstOrCreate(['user_id' => $jId]);
}
$dt = Carbon::createFromFormat('Y-m-d\TH:i', $data['tanggal'])
->toDateTimeString();
if (SchedulePiBi::where('peserta_id', $data['peserta_id'])->exists()) {
return back()
->withErrors(['peserta_id' => 'Peserta sudah memiliki jadwal.'])
->withInput();
}
// Simpan jadwal baru, dengan juri utama dari elemen pertama
$schedule = SchedulePiBi::create([
'peserta_id' => $data['peserta_id'],
'juri_id' => $data['juri_id'][0],
'tanggal' => $dt,
'lokasi' => $data['lokasi'],
]);
// Attach semua juri ke pivot
$schedule->juris()->attach($data['juri_id']);
return redirect()
->route('admin.schedules.index')
->with('success', 'Jadwal dan juri berhasil disimpan.');
}
public function update(Request $request, $id)
{
$data = $request->validate([
'juri_id' => 'required|array|min:1',
'juri_id.*' => 'exists:users,id',
'tanggal' => 'required|date_format:Y-m-d\TH:i',
'lokasi' => 'required|string|max:150',
]);
// Pastikan profile juri ada
foreach ($data['juri_id'] as $jId) {
JuriProfile::firstOrCreate(['user_id' => $jId]);
}
$dt = Carbon::createFromFormat('Y-m-d\TH:i', $data['tanggal'])
->toDateTimeString();
$schedule = SchedulePiBi::findOrFail($id);
// (Opsional) Jangan ubah kolom juri_id utama,
// atau set ke juri pertama jika Anda mau:
// $schedule->juri_id = $data['juri_id'][0];
$schedule->update([
// jika Anda ingin juri utama berganti:
// 'juri_id' => $data['juri_id'][0],
'tanggal' => $dt,
'lokasi' => $data['lokasi'],
]);
// Hanya tambahkan juri baru, tanpa menghapus yang lama:
$schedule->juris()->syncWithoutDetaching($data['juri_id']);
return redirect()
->route('admin.schedules.index')
->with('success', 'Jadwal diperbarui dan juri tambahan berhasil ditambahkan.');
}
public function destroy($id)
{
$schedule = SchedulePiBi::findOrFail($id);
// Detach semua juri di pivot
$schedule->juris()->detach();
$schedule->delete();
return redirect()
->route('admin.schedules.index')
->with('success', 'Jadwal berhasil dihapus.');
}
public function detail($id)
{
$schedule = SchedulePiBi::with(['peserta', 'juris'])->findOrFail($id);
return view('admin.schedules._detail', compact('schedule'));
}
}

View File

@ -0,0 +1,16 @@
<?php
// app/Http/Controllers/Admin/ManajemenAkunController.php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
class VerifikasiBerkasController extends Controller
{
/**
* Tampilkan halaman Manajemen Akun
*/
public function index()
{
return view('admin.verifikasiberkas');
}
}

View File

@ -0,0 +1,68 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use App\Models\User;
class LoginController extends Controller
{
public function __construct()
{
$this->middleware('guest')->except('logout');
}
public function showLoginForm()
{
return view('auth.login');
}
public function login(Request $request)
{
$credentials = $request->validate([
'email' => 'string',
'password' => 'string',
]);
if (Auth::attempt($credentials)) {
$request->session()->regenerate();
$user = Auth::user();
if ($user->role === 'admin') {
return redirect()->route('admin.dashboard');
} elseif ($user->role === 'juri') {
return redirect()->route('juri.dashboard');
} elseif ($user->role === 'peserta') {
return redirect()->route('user.dashboard');
} else {
Auth::logout();
return redirect()->route('login')->withErrors(['email' => 'Role tidak dikenali.']);
}
}
// if (Auth::attempt($credentials)) {
// $request->session()->regenerate();
// if (Auth::check() && User::isAdmin()) { // Gunakan $user->isAdmin()
// return redirect()->route('admin.dashboard');
// } else {
// return redirect()->route('user.dashboard');
// }
// }
return back()->withErrors([
'email' => 'The provided credentials do not match our records.',
])->onlyInput('email');
}
public function logout(Request $request)
{
Auth::logout();
$request->session()->invalidate();
$request->session()->regenerateToken();
return redirect()->route('login');
}
}

View File

@ -0,0 +1,84 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\DB;
class RegisterController extends Controller
{
public function __construct()
{
$this->middleware('guest');
}
public function showRegistrationForm()
{
return view('auth.register');
}
public function register(Request $request)
{
$request->validate([
'name' => 'required|string|max:100',
'email' => 'required|string|email|max:100|unique:users,email',
'password' => 'required|string|min:8|confirmed',
'nik' => 'required|string|max:20',
'tempat_lahir' => 'required|string|max:50',
'tanggal_lahir' => 'required|date',
'nim' => 'required|string|max:20|unique:peserta_profile,nim',
'no_hp' => 'required|string|max:20',
'program_pendidikan' => 'required|in:Diploma3,Diploma4',
'program_studi' => 'required|string|max:100',
'semester_ke' => 'required|integer|min:1',
'ipk' => 'required|numeric|min:0|max:4',
'pas_foto' => 'required|image|max:2048',
'surat_pengantar' => 'required|file|mimes:pdf,doc,docx|max:5120',
'jurusan' => 'required|string|max:100',
]);
// Simpan file lebih dulu
$fotoPath = $request->file('pas_foto')->store('peserta/foto', 'public');
$suratPath = $request->file('surat_pengantar')->store('peserta/surat', 'public');
DB::beginTransaction();
try {
// 1. Buat User
$user = User::create([
'name' => $request->name,
'email' => $request->email,
'password' => Hash::make($request->password),
'role' => 'peserta',
]);
// 2. Buat PesertaProfile VIA relasi, user_id otomatis terisi
$user->pesertaProfile()->create([
'nik' => $request->nik,
'tempat_lahir' => $request->tempat_lahir,
'tanggal_lahir' => $request->tanggal_lahir,
'nim' => $request->nim,
'no_hp' => $request->no_hp,
'program_pendidikan' => $request->program_pendidikan,
'program_studi' => $request->program_studi,
'semester_ke' => $request->semester_ke,
'ipk' => $request->ipk,
'pas_foto' => $fotoPath,
'surat_pengantar' => $suratPath,
'jurusan' => $request->jurusan,
]);
DB::commit();
} catch (\Exception $e) {
DB::rollBack();
return back()
->withInput()
->withErrors(['error' => 'Pendaftaran gagal: ' . $e->getMessage()]);
}
return redirect()->route('login')
->with('success', 'Pendaftaran berhasil! Silakan login.');
}
}

View File

@ -0,0 +1,11 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
class Controller extends BaseController
{
use AuthorizesRequests, ValidatesRequests;
}

View File

@ -0,0 +1,57 @@
<?php
namespace App\Http\Controllers\Juri;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;
use App\Models\PenilaianAkhir;
class DashboardJuriController extends Controller
{
public function __construct()
{
$this->middleware('auth');
}
public function index()
{
$juriId = Auth::id();
// 1) Hitung jumlah peserta unik yang lolos CU
$passedCount = DB::table('cu_selection')
->where('status_lolos', 'lolos')
->distinct('peserta_id')
->count('peserta_id');
// 2) Ambil jadwal PI/BI untuk juri
$schedules = DB::table('schedule_pi_bi_juri as spbj')
->join('schedule_pi_bi as spb', 'spbj.schedule_id', '=', 'spb.id')
->join('users as u', 'spb.peserta_id', '=', 'u.id')
->select('spb.id', 'u.name as peserta_name', 'spb.tanggal', 'spb.lokasi')
->where('spbj.juri_id', $juriId)
->orderBy('spb.tanggal', 'asc')
->get();
// 3) Ambil ranking dari penilaian_akhir langsung (pakai total_akhir)
$rankings = PenilaianAkhir::join('peserta_profile as pp', 'penilaian_akhir.peserta_id', '=', 'pp.user_id')
->join('users as u', 'pp.user_id', '=', 'u.id')
->whereIn('penilaian_akhir.peserta_id', function($q) {
$q->select('peserta_id')
->from('cu_selection')
->where('status_lolos', 'lolos');
})
->orderByDesc('penilaian_akhir.total_akhir')
->select([
'penilaian_akhir.peserta_id',
'u.name as peserta_name',
'penilaian_akhir.skor_cu_normal',
'penilaian_akhir.skor_pi_normal',
'penilaian_akhir.skor_bi_normal',
'penilaian_akhir.total_akhir',
])
->get();
return view('juri.dashboard', compact('passedCount', 'schedules', 'rankings'));
}
}

View File

@ -0,0 +1,38 @@
<?php
namespace App\Http\Controllers\Juri;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;
class JadwalJuriController extends Controller
{
public function __construct()
{
$this->middleware('auth');
}
/**
* Tampilkan daftar jadwal penilaian untuk juri yang sedang login.
*/
public function index()
{
$juriId = Auth::id();
$schedules = DB::table('schedule_pi_bi_juri as spbj')
->join('schedule_pi_bi as spb', 'spbj.schedule_id', '=', 'spb.id')
->join('users as u', 'spb.peserta_id', '=', 'u.id')
->select(
'spb.id',
'u.name as peserta_name',
'spb.tanggal',
'spb.lokasi'
)
->where('spbj.juri_id', $juriId)
->orderBy('spb.tanggal', 'asc')
->get();
return view('juri.jadwaljuri', compact('schedules'));
}
}

View File

@ -0,0 +1,97 @@
<?php
namespace App\Http\Controllers\Juri;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;
use App\Models\SchedulePiBi;
use App\Models\PenilaianPiJuri;
use App\Models\PenilaianBiJuri;
use App\Models\PenilaianAkhir;
use App\Models\BobotKriteria;
use Illuminate\Http\Request;
class PenilaianJuriController extends Controller
{
public function __construct()
{
$this->middleware('auth');
}
public function index()
{
$juriId = Auth::id();
$schedules = SchedulePiBi::with('peserta')
->join('schedule_pi_bi_juri as spbj', 'schedule_pi_bi.id', '=', 'spbj.schedule_id')
->where('spbj.juri_id', $juriId)
->select('schedule_pi_bi.*')
->get();
return view('juri.penilaian.penilaian', compact('schedules'));
}
public function storePi(Request $request, SchedulePiBi $schedule)
{
// ... validasi seperti sebelumnya ...
$data = $request->validate([
'penyajian' => 'required|numeric|between:0,15',
'substansi_masalah' => 'required|numeric|between:0,20',
'substansi_solusi' => 'required|numeric|between:0,35',
'kualitas_pi' => 'required|numeric|between:0,30',
]);
$data['schedule_id'] = $schedule->id;
$data['total_score'] = array_sum([$data['penyajian'], $data['substansi_masalah'], $data['substansi_solusi'], $data['kualitas_pi']]);
PenilaianPiJuri::create($data);
$this->updatePenilaianAkhir($schedule->peserta_id);
return back()->with('success', 'Penilaian PI disimpan.');
}
public function storeBi(Request $request, SchedulePiBi $schedule)
{
// ... validasi seperti sebelumnya ...
$data = $request->validate([
'content_score' => 'required|numeric|between:0,25',
'accuracy_score' => 'required|numeric|between:0,25',
'fluency_score' => 'required|numeric|between:0,20',
'pronunciation_score' => 'required|numeric|between:0,20',
'overall_perf_score' => 'required|numeric|between:0,10',
]);
$data['schedule_id'] = $schedule->id;
$data['total_score'] = array_sum([$data['content_score'], $data['accuracy_score'], $data['fluency_score'], $data['pronunciation_score'], $data['overall_perf_score']]);
PenilaianBiJuri::create($data);
$this->updatePenilaianAkhir($schedule->peserta_id);
return back()->with('success', 'Penilaian BI disimpan.');
}
private function updatePenilaianAkhir(int $pesertaId): void
{
// Ambil semua schedule_id peserta
$scheduleIds = SchedulePiBi::where('peserta_id', $pesertaId)->pluck('id');
// Hitung PI & BI normalisasi rata-rata
$piNormal = PenilaianPiJuri::whereIn('schedule_id', $scheduleIds)
->get()->avg(fn($row) => $row->total_score / 100) ?: 0.0;
$biNormal = PenilaianBiJuri::whereIn('schedule_id', $scheduleIds)
->get()->avg(fn($row) => $row->total_score / 100) ?: 0.0;
// Ambil CU yang tersimpan
$skorCu = PenilaianAkhir::where('peserta_id', $pesertaId)
->value('skor_cu_normal') ?: 0.0;
// Hitung total terpadu tanpa mereset CU
$bobot = BobotKriteria::pluck('bobot','nama_kriteria')->toArray();
$total = round(
$skorCu * ($bobot['CU'] ?? 0)
+ $piNormal * ($bobot['PI'] ?? 0)
+ $biNormal * ($bobot['BI'] ?? 0)
, 4);
// Simpan hasil tanpa menimpa CU
$pa = PenilaianAkhir::firstOrNew(['peserta_id' => $pesertaId]);
$pa->skor_cu_normal = $skorCu;
$pa->skor_pi_normal = $piNormal;
$pa->skor_bi_normal = $biNormal;
$pa->total_akhir = $total;
$pa->save();
}
}

View File

@ -0,0 +1,70 @@
<?php
namespace App\Http\Controllers\Juri;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\DB;
class PesertaController extends Controller
{
public function __construct()
{
$this->middleware('auth');
}
/**
* Tampilkan daftar semua peserta.
*/
public function index()
{
$peserta = DB::table('users as u')
->join('peserta_profile as pp', 'u.id', '=', 'pp.user_id')
->where('u.role', 'peserta')
->select(
'u.id',
'u.name',
'pp.nim',
'pp.program_studi',
'pp.semester_ke'
)
->orderBy('u.name')
->get();
return view('juri.peserta.index', compact('peserta'));
}
/**
* Tampilkan detail profile seorang peserta.
*/
public function show($id)
{
$peserta = DB::table('users as u')
->join('peserta_profile as pp', 'u.id', '=', 'pp.user_id')
->where('u.role', 'peserta')
->where('u.id', $id)
->select(
'u.id',
'u.name',
'u.email',
'pp.nik',
'pp.tempat_lahir',
'pp.tanggal_lahir',
'pp.nim',
'pp.no_hp',
'pp.program_pendidikan',
'pp.program_studi',
'pp.semester_ke',
'pp.ipk',
'pp.perguruan_tinggi',
'pp.alamat_pt',
'pp.email_pt'
)
->first();
if (! $peserta) {
abort(404);
}
return view('juri.peserta.show', compact('peserta'));
}
}

View File

@ -0,0 +1,21 @@
<?php
namespace App\Http\Controllers\Juri;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
class PresentasiController extends Controller
{
public function index()
{
$data = [
'title' => 'Data Alternatif',
'categories' => [
['id' => 1, 'name' => 'Ahmad', 'pi' => '!', 'bi' => '!']
]
];
return view('juri.presentasi', $data);
}
}

View File

@ -0,0 +1,33 @@
<?php
namespace App\Http\Controllers;
use App\Models\HeroSlide;
use App\Models\Purpose;
use App\Models\Requirement;
use App\Models\Schedule;
use Illuminate\Http\Request;
class LandingController extends Controller
{
/**
* Tampilkan halaman landing dengan data dynamic.
*/
public function index()
{
// ambil data sesuai urutan
$heroSlides = HeroSlide::with('features')->orderBy('order')->get();
$purposes = Purpose::orderBy('order')->get();
$requirements = Requirement::orderBy('order')->get();
$schedules = Schedule::orderBy('order')->get();
// lempar ke view
return view('landing', compact(
'heroSlides',
'purposes',
'requirements',
'schedules'
));
}
}

View File

@ -0,0 +1,120 @@
<?php
namespace App\Http\Controllers\User;
use App\Http\Controllers\Controller;
use App\Models\CuSubmission;
use App\Models\KategoriCu;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Storage;
class BerkasController extends Controller
{
public function __construct()
{
// Hanya peserta yang bisa mengakses
$this->middleware('auth');
}
/**
* Tampilkan daftar submission milik peserta.
*/
public function index()
{
$submissions = CuSubmission::where('peserta_id', Auth::id())
->orderBy('submitted_at', 'desc')
->get();
$kategoris = KategoriCu::with('level','bidang')->get();
return view('user.berkas', compact('submissions', 'kategoris'));
}
/**
* Tampilkan form unggah CU.
*/
public function create()
{
$kategoris = KategoriCu::all();
return view('user.berkas_create', compact('kategoris'));
}
/**
* Proses unggah dan simpan record baru.
*/
public function store(Request $request)
{
// Pastikan pesertaProfile sudah ada
if (! Auth::user()->pesertaProfile) {
return redirect()->route('profile.create')
->with('error', 'Lengkapi profil Anda terlebih dahulu sebelum mengunggah CU.');
}
$data = $request->validate([
'kategori_cu_id' => 'required|exists:kategori_cu,id',
'file' => 'required|file|mimes:pdf,zip|max:10240', // 10MB
]);
// Ambil skor default dari kategori
$kategori = KategoriCu::findOrFail($data['kategori_cu_id']);
$defaultSkor = $kategori->skor;
// Simpan file di storage/app/public/cu_submissions
$path = $request->file('file')->store('cu_submissions', 'public');
// Simpan submission CU
CuSubmission::create([
'peserta_id' => Auth::id(),
'kategori_cu_id' => $data['kategori_cu_id'],
'file_path' => $path,
'status' => CuSubmission::STATUS_PENDING,
'skor' => $defaultSkor,
]);
return redirect()->route('berkas.index')
->with('success', "Berkas berhasil diunggah (skor default: {$defaultSkor}) dan menunggu review.");
}
/**
* Unduh berkas CU peserta.
*/
public function show(CuSubmission $berkas)
{
// Cek apakah pemilik berkas
if (Auth::id() !== $berkas->peserta_id) {
abort(403, 'Anda tidak diizinkan mengakses berkas ini.');
}
// Cek apakah file ada
if (! Storage::disk('public')->exists($berkas->file_path)) {
abort(404, 'File tidak ditemukan.');
}
return Storage::disk('public')->download($berkas->file_path);
}
/**
* Hapus berkas CU jika masih pending dan milik peserta.
*/
public function destroy(CuSubmission $berkas)
{
// Cek status: hanya yang pending atau rejected yang boleh dihapus
if ($berkas->status === CuSubmission::STATUS_APPROVED) {
return back()->with('error', 'Berkas yang sudah disetujui tidak bisa dihapus.');
}
// Hapus file fisik jika ada
if ($berkas->file_path && Storage::disk('public')->exists($berkas->file_path)) {
Storage::disk('public')->delete($berkas->file_path);
}
// Hapus record dari database
$berkas->delete();
return back()->with('success', 'Berkas berhasil dihapus.');
}
}

View File

@ -0,0 +1,27 @@
<?php
namespace App\Http\Controllers\User;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class DashboardController extends Controller
{
public function index()
{
// Auth::logout();
return view('user.dashboard');
}
public function profile()
{
return view('user.profile');
}
public function updateProfile(Request $request)
{
// Logic untuk update profile
return back()->with('success', 'Profile berhasil diperbarui');
}
}

View File

@ -0,0 +1,51 @@
<?php
namespace App\Http\Controllers\User;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use App\Models\CuSelection;
use App\Models\PenilaianAkhir;
use App\Models\PesertaProfile;
use App\Models\User;
class HasilController extends Controller
{
/**
* Tampilkan halaman hasil perhitungan.
*/
public function index()
{
$userId = Auth::id();
// Ambil status CU selection terbaru untuk peserta ini
$selection = CuSelection::where('peserta_id', $userId)
->latest('selection_round')
->first();
// Jika peserta lolos, ambil ranking nilai akhir
$rankings = collect();
if ($selection && $selection->status_lolos === 'lolos') {
$rankings = PenilaianAkhir::join('peserta_profile as pp', 'penilaian_akhir.peserta_id', '=', 'pp.user_id')
->join('users as u', 'pp.user_id', '=', 'u.id')
->whereIn('penilaian_akhir.peserta_id', function($q) {
$q->select('peserta_id')
->from('cu_selection')
->where('status_lolos', 'lolos');
})
->orderByDesc('penilaian_akhir.total_akhir')
->select([
'penilaian_akhir.peserta_id',
'u.name',
'penilaian_akhir.skor_cu_normal',
'penilaian_akhir.skor_pi_normal',
'penilaian_akhir.skor_bi_normal',
'penilaian_akhir.total_akhir',
])
->get();
}
return view('user.hasil', compact('selection', 'rankings'));
}
}

View File

@ -0,0 +1,22 @@
<?php
namespace App\Http\Controllers\User;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Auth;
use App\Models\SchedulePiBi;
class JadwalController extends Controller
{
public function index()
{
$userId = Auth::id();
// Ambil hanya jadwal PI & BI untuk peserta yang sedang login
$schedules = SchedulePiBi::where('peserta_id', $userId)
->orderBy('tanggal')
->get();
return view('user.jadwal', compact('schedules'));
}
}

View File

@ -0,0 +1,116 @@
<?php
namespace App\Http\Controllers\User;
use App\Http\Controllers\Controller;
use App\Models\PesertaProfile;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Storage;
use Exception;
class ProfileController extends Controller
{
/**
* Tampilkan form:
* - jika file belum diunggah, tampilkan langkah 1 (upload)
* - selalu tampilkan form data
*/
public function form()
{
$user = Auth::user();
$profile = $user->pesertaProfile ?: new PesertaProfile(['user_id' => $user->id]);
return view('user.profile', compact('user','profile'));
}
/**
* Langkah 1: upload pas_foto & surat_pengantar via POST
*/
public function uploadFiles(Request $request)
{
$request->validate([
'pas_foto' => 'nullable|image|mimes:jpg,jpeg,png|max:2048',
'surat_pengantar' => 'nullable|mimes:pdf|max:5120',
]);
$user = Auth::user();
$profile = $user->pesertaProfile ?: new PesertaProfile(['user_id' => $user->id]);
// Buat direktori jika belum ada
Storage::disk('public')->makeDirectory('photos', 0755, true);
Storage::disk('public')->makeDirectory('letters', 0755, true);
// Simpan foto
if ($file = $request->file('pas_foto')) {
if ($profile->pas_foto) {
Storage::disk('public')->delete($profile->pas_foto);
}
$profile->pas_foto = $file->store('photos', 'public');
}
// Simpan surat
if ($file = $request->file('surat_pengantar')) {
if ($profile->surat_pengantar) {
Storage::disk('public')->delete($profile->surat_pengantar);
}
$profile->surat_pengantar = $file->store('letters', 'public');
}
$profile->save();
return redirect()
->route('user.profile.form')
->with('success', 'File berhasil diunggah. Silakan lengkapi data berikutnya.');
}
/**
* Langkah 2: simpan data teks profil via POST
*/
public function save(Request $request)
{
$user = Auth::user();
$rules = [
'name' => 'required|string|max:100',
'email' => 'required|email|max:100|unique:users,email,' . $user->id,
'password' => 'nullable|confirmed|min:6',
'nik' => 'required|string|size:16',
'nim' => 'required|string|max:20',
'no_hp' => 'required|string|max:20',
'tempat_lahir' => 'required|string|max:50',
'tanggal_lahir' => 'required|date',
'program_pendidikan' => 'required|in:Diploma,Sarjana,Diploma3,Diploma4',
'jurusan' => 'required|string|max:100',
'program_studi' => 'required|string|max:100',
'semester_ke' => 'required|integer|min:1',
'ipk' => 'required|numeric|between:0,4',
];
$data = $request->validate($rules);
try {
// Update user
$user->name = $data['name'];
$user->email = $data['email'];
if (!empty($data['password'])) {
$user->password = Hash::make($data['password']);
}
$user->save();
// Fill profil
$profile = $user->pesertaProfile ?: new PesertaProfile(['user_id' => $user->id]);
$profile->fill($data);
$profile->save();
return redirect()
->route('user.profile.form')
->with('success', 'Profil berhasil diperbarui.');
}
catch (Exception $e) {
return redirect()->back()
->withInput()
->withErrors(['error' => 'Terjadi kesalahan: '.$e->getMessage()]);
}
}
}

View File

@ -0,0 +1,23 @@
<?php
// app/Http/Middleware/AdminMiddleware.php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use App\Models\User;
class AdminMiddleware
{
public function handle(Request $request, Closure $next)
{
if (Auth::check() && User::isAdmin()) {
return $next($request);
}
return redirect('/')->with('error', 'You do not have access to this page.');
}
}

View File

@ -0,0 +1,19 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class JuriMiddleware
{
public function handle(Request $request, Closure $next)
{
if (Auth::check() && Auth::user()->role === 'juri') {
return $next($request);
}
return redirect('/')->with('error', 'Anda tidak memiliki akses sebagai juri.');
}
}

View File

@ -0,0 +1,61 @@
<?php
// app/Http/Middleware/UserMiddleware.php
// namespace App\Http\Middleware;
// use App\Models\User;
// use Closure;
// use Illuminate\Http\Request;
// use Illuminate\Support\Facades\Auth;
// class UserMiddleware
// {
// public function handle(Request $request, Closure $next)
// {
// // if (Auth::check() && User::isUser()) {
// // return $next($request);
// // }
// if (Auth::check() && Auth::user()->role === 'user') {
// return $next($request);
// }
// return redirect()->route('login')->with('error', 'You do not have access to this page.');
// }
// }
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Support\Facades\Auth;
class User extends Authenticatable
{
use HasFactory;
protected $fillable = [
'username',
'email',
'password',
'role',
];
public static function isAdmin()
{
return Auth::user()->role === 'admin'; // Sesuaikan dengan kolom di database
}
public static function isUser(): bool
{
return Auth::user()->role === 'user';
}
public static function isJuri(): bool
{
return Auth::user()->role === 'juri';
}
public function mahasiswa()
{
return $this->hasOne(Mahasiswa::class);
}
}

View File

View File

@ -0,0 +1,29 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class AdminProfile extends Model
{
// Tabel yang digunakan (jika nama tabel bukan plural default)
protected $table = 'admin_profile';
// Primary key
protected $primaryKey = 'user_id';
// Karena primary key bukan auto-increment integer, disable incrementing
public $incrementing = false;
protected $keyType = 'bigint';
// Jika tidak memakai timestamps
public $timestamps = false;
// Field yang boleh di-fill
protected $fillable = [
'user_id',
'no_hp',
'jabatan',
'instansi',
];
}

28
app/Models/BidangCu.php Normal file
View File

@ -0,0 +1,28 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class BidangCu extends Model
{
// Nama tabel jika tidak mengikuti konvensi Laravel (opsional jika tabel bernama 'bidang_cu')
protected $table = 'bidang_cu';
// Nonaktifkan timestamps (created_at, updated_at)
public $timestamps = false;
// Kolom yang boleh diisi mass-assignment
protected $fillable = [
'nama',
];
/**
* Relasi ke Kategori CU:
* Satu Bidang memiliki banyak KategoriCu.
*/
public function kategoris()
{
return $this->hasMany(KategoriCu::class, 'bidang_id');
}
}

View File

@ -0,0 +1,25 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class BobotKriteria extends Model
{
protected $table = 'bobot_kriteria';
protected $primaryKey = 'nama_kriteria';
public $incrementing = false;
public $timestamps = false;
protected $keyType = 'string';
protected $fillable = [
'nama_kriteria',
'bobot',
];
protected $casts = [
'bobot' => 'decimal:2',
];
}

View File

@ -0,0 +1,42 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class CuSelection extends Model
{
protected $table = 'cu_selection';
protected $primaryKey = 'id';
public $incrementing = true;
public $timestamps = false;
protected $fillable = [
'peserta_id',
'level_id',
'selection_round',
'status_lolos',
'skor_cu', // ← pastikan ada
'selected_at',
'submission_id', // jika Anda menambahkan ini
];
public function peserta(): BelongsTo
{
return $this->belongsTo(PesertaProfile::class, 'peserta_id', 'user_id');
}
/**
* Relasi ke tabel level_cu untuk mendapatkan deskripsi level
*/
public function level(): BelongsTo
{
return $this->belongsTo(LevelCu::class, 'level_id', 'level');
}
public function penilaianAkhir(): BelongsTo
{
return $this->belongsTo(PenilaianAkhir::class, 'peserta_id', 'peserta_id');
}
}

View File

@ -0,0 +1,47 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class CuSubmission extends Model
{
protected $table = 'cu_submission';
protected $primaryKey = 'id';
public $timestamps = false;
const STATUS_PENDING = 'pending';
const STATUS_APPROVED = 'approved';
const STATUS_REJECTED = 'rejected';
protected $fillable = [
'peserta_id',
'kategori_cu_id',
'file_path',
'status',
'reviewed_at',
'comment',
'skor',
];
protected $casts = [
'submitted_at' => 'datetime',
'reviewed_at' => 'datetime',
'skor' => 'decimal:2',
];
public function peserta()
{
return $this->belongsTo(PesertaProfile::class, 'peserta_id', 'user_id');
}
public function kategori()
{
return $this->belongsTo(KategoriCu::class, 'kategori_cu_id', 'id');
}
public function kategoriCu()
{
return $this->belongsTo(KategoriCu::class, 'kategori_cu_id', 'id');
}
}

View File

@ -0,0 +1,23 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class HeroFeature extends Model
{
use HasFactory;
protected $fillable = [
'hero_slide_id',
'icon_class',
'text',
'order',
];
public function heroSlide()
{
return $this->belongsTo(HeroSlide::class);
}
}

25
app/Models/HeroSlide.php Normal file
View File

@ -0,0 +1,25 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class HeroSlide extends Model
{
use HasFactory;
protected $fillable = [
'title',
'subtitle',
'image_path',
'button_text',
'button_url',
'order',
];
public function features()
{
return $this->hasMany(HeroFeature::class);
}
}

View File

@ -0,0 +1,21 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class JuriProfile extends Model
{
protected $table = 'juri_profile';
protected $primaryKey = 'user_id';
public $incrementing = false;
protected $keyType = 'bigint';
public $timestamps = false;
protected $fillable = [
'user_id',
'no_hp',
'instansi',
'bidang_keahlian',
];
}

48
app/Models/KategoriCu.php Normal file
View File

@ -0,0 +1,48 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class KategoriCu extends Model
{
protected $table = 'kategori_cu';
protected $primaryKey = 'id';
public $timestamps = false;
protected $fillable = [
'bidang_id',
'wujud_cu',
'kode',
'level_id',
'skor',
];
protected $casts = [
'skor' => 'decimal:2',
];
/**
* Relasi ke tabel bidang_cu
*/
public function bidang()
{
return $this->belongsTo(BidangCu::class, 'bidang_id', 'id');
}
/**
* Relasi ke tabel level_cu untuk detail level
*/
public function level()
{
return $this->belongsTo(LevelCu::class, 'level_id', 'level');
}
/**
* Relasi ke semua submission CU untuk kategori ini
*/
public function submissions()
{
return $this->hasMany(CuSubmission::class, 'kategori_cu_id', 'id');
}
}

30
app/Models/LevelCu.php Normal file
View File

@ -0,0 +1,30 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class LevelCu extends Model
{
protected $table = 'level_cu';
// Primary key non-incrementing string
protected $primaryKey = 'level';
public $incrementing = false;
protected $keyType = 'string';
public $timestamps = false;
protected $fillable = [
'level',
'description',
];
/**
* Relasi ke Kategori CU
*/
public function kategoris()
{
return $this->hasMany(KategoriCu::class, 'level_id', 'level');
}
}

35
app/Models/Mahasiswa.php Normal file
View File

@ -0,0 +1,35 @@
<?php
// app/Models/Mahasiswa.php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Mahasiswa extends Model
{
use HasFactory;
protected $fillable = [
'user_id',
'nama_lengkap',
'nim',
'tempat_lahir',
'tanggal_lahir',
'jenis_kelamin',
'no_handphone',
'email',
'jurusan',
'prodi',
'foto',
];
protected $casts = [
'tanggal_lahir' => 'date',
];
public function user()
{
return $this->belongsTo(User::class);
}
}

View File

@ -0,0 +1,34 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class PenilaianAkhir extends Model
{
protected $table = 'penilaian_akhir';
protected $primaryKey = 'peserta_id';
public $incrementing = false;
public $timestamps = false;
protected $fillable = [
'peserta_id',
'skor_cu_normal',
'skor_pi_normal',
'skor_bi_normal',
'total_akhir',
];
protected $casts = [
'skor_cu_normal' => 'decimal:4',
'skor_pi_normal' => 'decimal:4',
'skor_bi_normal' => 'decimal:4',
'total_akhir' => 'decimal:4',
];
public function peserta()
{
return $this->belongsTo(PesertaProfile::class, 'peserta_id', 'user_id');
}
}

View File

@ -0,0 +1,35 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class PenilaianBiJuri extends Model
{
protected $table = 'penilaian_bi_juri';
public $timestamps = false;
protected $fillable = [
'schedule_id',
'content_score',
'accuracy_score',
'fluency_score',
'pronunciation_score',
'overall_perf_score',
'total_score', // ← tambahkan ini
];
protected $casts = [
'content_score' => 'decimal:2',
'accuracy_score' => 'decimal:2',
'fluency_score' => 'decimal:2',
'pronunciation_score' => 'decimal:2',
'overall_perf_score' => 'decimal:2',
'total_score' => 'decimal:2', // ← dan ini
];
public function schedule()
{
return $this->belongsTo(SchedulePiBi::class, 'schedule_id');
}
}

View File

@ -0,0 +1,39 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class PenilaianPiJuri extends Model
{
// Nama tabel sesuai dump
protected $table = 'penilaian_pi_juri';
// Tidak pakai created_at/updated_at
public $timestamps = false;
// Field yang boleh dimass assign
protected $fillable = [
'schedule_id',
'penyajian',
'substansi_masalah',
'substansi_solusi',
'kualitas_pi',
'total_score',
];
// Tipe data kolom
protected $casts = [
'penyajian' => 'decimal:2',
'substansi_masalah' => 'decimal:2',
'substansi_solusi' => 'decimal:2',
'kualitas_pi' => 'decimal:2',
'total_score' => 'decimal:2',
];
// Relasi ke jadwal
public function schedule()
{
return $this->belongsTo(SchedulePiBi::class, 'schedule_id');
}
}

View File

@ -0,0 +1,61 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class PesertaProfile extends Model
{
protected $table = 'peserta_profile';
protected $primaryKey = 'user_id';
public $incrementing = false;
public $timestamps = false;
protected $fillable = [
'user_id',
'nik',
'tempat_lahir',
'tanggal_lahir',
'nim',
'no_hp',
'program_pendidikan',
'program_studi',
'semester_ke',
'ipk',
'kode_pt',
'wilayah_lldikti',
'perguruan_tinggi',
'alamat_pt',
'telp_pt',
'email_pt',
'pas_foto',
'surat_pengantar',
'jurusan',
];
protected $casts = [
'tanggal_lahir' => 'date',
'ipk' => 'decimal:2',
];
public function user(): BelongsTo
{
return $this->belongsTo(User::class, 'user_id', 'id');
}
// Akses nama langsung via $peserta->name
public function getNameAttribute(): ?string
{
return $this->user?->name;
}
public function cuSelection()
{
return $this->hasMany(
\App\Models\CuSelection::class,
'peserta_id', // FK di cu_selection
'user_id' // PK di peserta_profile
);
}
}

18
app/Models/Purpose.php Normal file
View File

@ -0,0 +1,18 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Purpose extends Model
{
use HasFactory;
protected $fillable = [
'title',
'description',
'icon_path',
'order',
];
}

View File

@ -0,0 +1,30 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class RekapPenilaianTahunan extends Model
{
use HasFactory;
protected $table = 'rekap_penilaian_tahunan';
protected $fillable = [
'peserta_id',
'tahun',
'skor_cu_normal',
'skor_pi_normal',
'skor_bi_normal',
'total_akhir',
'status_cu',
'selection_round',
];
public function peserta()
{
return $this->belongsTo(PesertaProfile::class, 'peserta_id', 'user_id');
}
}

View File

@ -0,0 +1,16 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Requirement extends Model
{
use HasFactory;
protected $fillable = [
'text',
'order',
];
}

33
app/Models/Schedule.php Normal file
View File

@ -0,0 +1,33 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Carbon\Carbon;
class Schedule extends Model
{
use HasFactory;
protected $fillable = [
'date_from',
'date_to',
'activity',
'order',
];
protected $appends = ['time'];
public function getTimeAttribute()
{
$from = Carbon::parse($this->date_from)->format('d M Y');
$to = Carbon::parse($this->date_to)->format('d M Y');
// jika sama hari, cukup satu
if ($from === $to) {
return $from;
}
return "{$from} {$to}";
}
}

View File

@ -0,0 +1,53 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use App\Models\User;
class SchedulePiBi extends Model
{
protected $table = 'schedule_pi_bi';
public $timestamps = false;
protected $fillable = [
'peserta_id',
'juri_id',
'tanggal',
'lokasi',
];
/**
* Agar kolom `tanggal` dicast sebagai Carbon datetime (termasuk jam:menit)
*/
protected $casts = [
'tanggal' => 'datetime:Y-m-d H:i:s',
];
/**
* Relasi many-to-many ke model User sebagai juri
*/
public function juris(): BelongsToMany
{
return $this->belongsToMany(
User::class,
'schedule_pi_bi_juri', // nama pivot table
'schedule_id', // FK di pivot menuju schedule
'juri_id' // FK di pivot menuju user (juri)
)->withTimestamps();
}
/**
* Relasi one-to-many inverse ke model User sebagai peserta
*/
public function peserta(): BelongsTo
{
return $this->belongsTo(
User::class,
'peserta_id', // FK di table schedule_pi_bi
'id' // PK di table users
);
}
}

96
app/Models/User.php Normal file
View File

@ -0,0 +1,96 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Support\Facades\Auth;
use Illuminate\Notifications\Notifiable;
use App\Models\PesertaProfile;
use App\Models\AdminProfile;
use App\Models\JuriProfile;
class User extends Authenticatable
{
use HasFactory ,Notifiable;
protected $fillable = [
'name', // ubah dari 'nama' menjadi 'name'
'email',
'password',
'role',
'email_verified_at',
'remember_token',
];
// …
// (opsional) relasi ke PesertaProfile
public function pesertaProfile()
{
return $this->hasOne(PesertaProfile::class, 'user_id', 'id');
}
protected $hidden = [
'password',
'remember_token',
];
protected $casts = [
'email_verified_at' => 'datetime',
];
public static function isAdmin()
{
return Auth::user()->role === 'admin'; // Sesuaikan dengan kolom di database
}
public static function isUser(): bool
{
return Auth::user()->role === 'users'; // Sesuaikan dengan kolom di database
}
public function mahasiswa()
{
return $this->hasOne(Mahasiswa::class);
}
public function isJuri()
{
return $this->role === 'juri';
}
public function schedulePiBis()
{
return $this->belongsToMany(SchedulePiBi::class, 'schedule_pibi_user', 'user_id', 'schedule_pibi_id');
}
public function adminProfile()
{
return $this->hasOne(AdminProfile::class, 'user_id');
}
public function juriProfile()
{
return $this->hasOne(JuriProfile::class, 'user_id');
}
public function profile()
{
if ($this->role === 'admin') {
return $this->adminProfile;
}
if ($this->role === 'juri') {
return $this->juriProfile;
}
if ($this->role === 'peserta') {
return $this->pesertaProfile;
}
return null;
}
public function penilaianAkhir()
{
return $this->hasOne(PenilaianAkhir::class, 'peserta_id', 'id');
}
}

View File

@ -0,0 +1,25 @@
<?php
namespace App\Observers;
use App\Models\CuSubmission;
use App\Services\CuSelectionService;
class CuSubmissionObserver
{
protected CuSelectionService $service;
public function __construct(CuSelectionService $service)
{
$this->service = $service;
}
public function updated(CuSubmission $submission)
{
// kalau baru saja disetujui, recalculation
if ($submission->isDirty('status')
&& $submission->status === CuSubmission::STATUS_APPROVED) {
$this->service->recalculateForPeserta($submission->peserta_id);
}
}
}

View File

@ -0,0 +1,25 @@
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
namespace App\Providers;
use Illuminate\Support\Facades\Route;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
class RouteServiceProvider extends ServiceProvider
{
public function boot()
{
parent::boot(); // Panggil method boot dari parent class
Route::middleware('web')
->group(base_path('routes/web.php'));
Route::middleware('api')
->group(base_path('routes/api.php'));
}
}

18
artisan Normal file
View File

@ -0,0 +1,18 @@
#!/usr/bin/env php
<?php
use Illuminate\Foundation\Application;
use Symfony\Component\Console\Input\ArgvInput;
define('LARAVEL_START', microtime(true));
// Register the Composer autoloader...
require __DIR__.'/vendor/autoload.php';
// Bootstrap Laravel and handle the command...
/** @var Application $app */
$app = require_once __DIR__.'/bootstrap/app.php';
$status = $app->handleCommand(new ArgvInput);
exit($status);

23
bootstrap/app.php Normal file
View File

@ -0,0 +1,23 @@
<?php
use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Foundation\Configuration\Middleware;
return Application::configure(basePath: dirname(__DIR__))
->withRouting(
web: __DIR__.'/../routes/web.php',
commands: __DIR__.'/../routes/console.php',
health: '/up',
)
->withMiddleware(function (Middleware $middleware) {
// Tambahkan middleware kustom di sini
$middleware->alias([
'admin' => \App\Http\Middleware\AdminMiddleware::class,
'user' => \App\Http\Middleware\UserMiddleware::class,
]);
})
->withExceptions(function (Exceptions $exceptions) {
//
})->create();

2
bootstrap/cache/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*
!.gitignore

5
bootstrap/providers.php Normal file
View File

@ -0,0 +1,5 @@
<?php
return [
App\Providers\AppServiceProvider::class,
];

74
composer.json Normal file
View File

@ -0,0 +1,74 @@
{
"$schema": "https://getcomposer.org/schema.json",
"name": "laravel/laravel",
"type": "project",
"description": "The skeleton application for the Laravel framework.",
"keywords": ["laravel", "framework"],
"license": "MIT",
"require": {
"php": "^8.2",
"barryvdh/laravel-dompdf": "^3.1",
"laravel/framework": "^12.0",
"laravel/sanctum": "^4.0",
"laravel/tinker": "^2.10.1",
"maatwebsite/excel": "^3.1"
},
"require-dev": {
"fakerphp/faker": "^1.23",
"laravel/pail": "^1.2.2",
"laravel/pint": "^1.13",
"laravel/sail": "^1.41",
"mockery/mockery": "^1.6",
"nunomaduro/collision": "^8.6",
"phpunit/phpunit": "^11.5.3"
},
"autoload": {
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-update-cmd": [
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi",
"@php -r \"file_exists('database/database.sqlite') || touch('database/database.sqlite');\"",
"@php artisan migrate --graceful --ansi"
],
"dev": [
"Composer\\Config::disableProcessTimeout",
"npx concurrently -c \"#93c5fd,#c4b5fd,#fb7185,#fdba74\" \"php artisan serve\" \"php artisan queue:listen --tries=1\" \"php artisan pail --timeout=0\" \"npm run dev\" --names=server,queue,logs,vite"
]
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true,
"allow-plugins": {
"pestphp/pest-plugin": true,
"php-http/discovery": true
}
},
"minimum-stability": "stable",
"prefer-stable": true
}

9097
composer.lock generated Normal file

File diff suppressed because it is too large Load Diff

126
config/app.php Normal file
View File

@ -0,0 +1,126 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Application Name
|--------------------------------------------------------------------------
|
| This value is the name of your application, which will be used when the
| framework needs to place the application's name in a notification or
| other UI elements where an application name needs to be displayed.
|
*/
'name' => env('APP_NAME', 'Laravel'),
/*
|--------------------------------------------------------------------------
| Application Environment
|--------------------------------------------------------------------------
|
| This value determines the "environment" your application is currently
| running in. This may determine how you prefer to configure various
| services the application utilizes. Set this in your ".env" file.
|
*/
'env' => env('APP_ENV', 'production'),
/*
|--------------------------------------------------------------------------
| Application Debug Mode
|--------------------------------------------------------------------------
|
| When your application is in debug mode, detailed error messages with
| stack traces will be shown on every error that occurs within your
| application. If disabled, a simple generic error page is shown.
|
*/
'debug' => (bool) env('APP_DEBUG', false),
/*
|--------------------------------------------------------------------------
| Application URL
|--------------------------------------------------------------------------
|
| This URL is used by the console to properly generate URLs when using
| the Artisan command line tool. You should set this to the root of
| the application so that it's available within Artisan commands.
|
*/
'url' => env('APP_URL', 'http://localhost'),
/*
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
|
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. The timezone
| is set to "UTC" by default as it is suitable for most use cases.
|
*/
'timezone' => 'UTC',
/*
|--------------------------------------------------------------------------
| Application Locale Configuration
|--------------------------------------------------------------------------
|
| The application locale determines the default locale that will be used
| by Laravel's translation / localization methods. This option can be
| set to any locale for which you plan to have translation strings.
|
*/
'locale' => env('APP_LOCALE', 'en'),
'fallback_locale' => env('APP_FALLBACK_LOCALE', 'en'),
'faker_locale' => env('APP_FAKER_LOCALE', 'en_US'),
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| This key is utilized by Laravel's encryption services and should be set
| to a random, 32 character string to ensure that all encrypted values
| are secure. You should do this prior to deploying the application.
|
*/
'cipher' => 'AES-256-CBC',
'key' => env('APP_KEY'),
'previous_keys' => [
...array_filter(
explode(',', env('APP_PREVIOUS_KEYS', ''))
),
],
/*
|--------------------------------------------------------------------------
| Maintenance Mode Driver
|--------------------------------------------------------------------------
|
| These configuration options determine the driver used to determine and
| manage Laravel's "maintenance mode" status. The "cache" driver will
| allow maintenance mode to be controlled across multiple machines.
|
| Supported drivers: "file", "cache"
|
*/
'maintenance' => [
'driver' => env('APP_MAINTENANCE_DRIVER', 'file'),
'store' => env('APP_MAINTENANCE_STORE', 'database'),
],
];

115
config/auth.php Normal file
View File

@ -0,0 +1,115 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Authentication Defaults
|--------------------------------------------------------------------------
|
| This option defines the default authentication "guard" and password
| reset "broker" for your application. You may change these values
| as required, but they're a perfect start for most applications.
|
*/
'defaults' => [
'guard' => env('AUTH_GUARD', 'web'),
'passwords' => env('AUTH_PASSWORD_BROKER', 'users'),
],
/*
|--------------------------------------------------------------------------
| Authentication Guards
|--------------------------------------------------------------------------
|
| Next, you may define every authentication guard for your application.
| Of course, a great default configuration has been defined for you
| which utilizes session storage plus the Eloquent user provider.
|
| All authentication guards have a user provider, which defines how the
| users are actually retrieved out of your database or other storage
| system used by the application. Typically, Eloquent is utilized.
|
| Supported: "session"
|
*/
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
],
/*
|--------------------------------------------------------------------------
| User Providers
|--------------------------------------------------------------------------
|
| All authentication guards have a user provider, which defines how the
| users are actually retrieved out of your database or other storage
| system used by the application. Typically, Eloquent is utilized.
|
| If you have multiple user tables or models you may configure multiple
| providers to represent the model / table. These providers may then
| be assigned to any extra authentication guards you have defined.
|
| Supported: "database", "eloquent"
|
*/
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => env('AUTH_MODEL', App\Models\User::class),
],
// 'users' => [
// 'driver' => 'database',
// 'table' => 'users',
// ],
],
/*
|--------------------------------------------------------------------------
| Resetting Passwords
|--------------------------------------------------------------------------
|
| These configuration options specify the behavior of Laravel's password
| reset functionality, including the table utilized for token storage
| and the user provider that is invoked to actually retrieve users.
|
| The expiry time is the number of minutes that each reset token will be
| considered valid. This security feature keeps tokens short-lived so
| they have less time to be guessed. You may change this as needed.
|
| The throttle setting is the number of seconds a user must wait before
| generating more password reset tokens. This prevents the user from
| quickly generating a very large amount of password reset tokens.
|
*/
'passwords' => [
'users' => [
'provider' => 'users',
'table' => env('AUTH_PASSWORD_RESET_TOKEN_TABLE', 'password_reset_tokens'),
'expire' => 60,
'throttle' => 60,
],
],
/*
|--------------------------------------------------------------------------
| Password Confirmation Timeout
|--------------------------------------------------------------------------
|
| Here you may define the amount of seconds before a password confirmation
| window expires and users are asked to re-enter their password via the
| confirmation screen. By default, the timeout lasts for three hours.
|
*/
'password_timeout' => env('AUTH_PASSWORD_TIMEOUT', 10800),
];

108
config/cache.php Normal file
View File

@ -0,0 +1,108 @@
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Cache Store
|--------------------------------------------------------------------------
|
| This option controls the default cache store that will be used by the
| framework. This connection is utilized if another isn't explicitly
| specified when running a cache operation inside the application.
|
*/
'default' => env('CACHE_STORE', 'database'),
/*
|--------------------------------------------------------------------------
| Cache Stores
|--------------------------------------------------------------------------
|
| Here you may define all of the cache "stores" for your application as
| well as their drivers. You may even define multiple stores for the
| same cache driver to group types of items stored in your caches.
|
| Supported drivers: "array", "database", "file", "memcached",
| "redis", "dynamodb", "octane", "null"
|
*/
'stores' => [
'array' => [
'driver' => 'array',
'serialize' => false,
],
'database' => [
'driver' => 'database',
'connection' => env('DB_CACHE_CONNECTION'),
'table' => env('DB_CACHE_TABLE', 'cache'),
'lock_connection' => env('DB_CACHE_LOCK_CONNECTION'),
'lock_table' => env('DB_CACHE_LOCK_TABLE'),
],
'file' => [
'driver' => 'file',
'path' => storage_path('framework/cache/data'),
'lock_path' => storage_path('framework/cache/data'),
],
'memcached' => [
'driver' => 'memcached',
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
'sasl' => [
env('MEMCACHED_USERNAME'),
env('MEMCACHED_PASSWORD'),
],
'options' => [
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
],
'servers' => [
[
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
'port' => env('MEMCACHED_PORT', 11211),
'weight' => 100,
],
],
],
'redis' => [
'driver' => 'redis',
'connection' => env('REDIS_CACHE_CONNECTION', 'cache'),
'lock_connection' => env('REDIS_CACHE_LOCK_CONNECTION', 'default'),
],
'dynamodb' => [
'driver' => 'dynamodb',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
'table' => env('DYNAMODB_CACHE_TABLE', 'cache'),
'endpoint' => env('DYNAMODB_ENDPOINT'),
],
'octane' => [
'driver' => 'octane',
],
],
/*
|--------------------------------------------------------------------------
| Cache Key Prefix
|--------------------------------------------------------------------------
|
| When utilizing the APC, database, memcached, Redis, and DynamoDB cache
| stores, there might be other applications using the same cache. For
| that reason, you may prefix every cache key to avoid collisions.
|
*/
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache_'),
];

174
config/database.php Normal file
View File

@ -0,0 +1,174 @@
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Database Connection Name
|--------------------------------------------------------------------------
|
| Here you may specify which of the database connections below you wish
| to use as your default connection for database operations. This is
| the connection which will be utilized unless another connection
| is explicitly specified when you execute a query / statement.
|
*/
'default' => env('DB_CONNECTION', 'sqlite'),
/*
|--------------------------------------------------------------------------
| Database Connections
|--------------------------------------------------------------------------
|
| Below are all of the database connections defined for your application.
| An example configuration is provided for each database system which
| is supported by Laravel. You're free to add / remove connections.
|
*/
'connections' => [
'sqlite' => [
'driver' => 'sqlite',
'url' => env('DB_URL'),
'database' => env('DB_DATABASE', database_path('database.sqlite')),
'prefix' => '',
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
'busy_timeout' => null,
'journal_mode' => null,
'synchronous' => null,
],
'mysql' => [
'driver' => 'mysql',
'url' => env('DB_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => env('DB_CHARSET', 'utf8mb4'),
'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'),
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
'mariadb' => [
'driver' => 'mariadb',
'url' => env('DB_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => env('DB_CHARSET', 'utf8mb4'),
'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'),
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
'pgsql' => [
'driver' => 'pgsql',
'url' => env('DB_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => env('DB_CHARSET', 'utf8'),
'prefix' => '',
'prefix_indexes' => true,
'search_path' => 'public',
'sslmode' => 'prefer',
],
'sqlsrv' => [
'driver' => 'sqlsrv',
'url' => env('DB_URL'),
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '1433'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => env('DB_CHARSET', 'utf8'),
'prefix' => '',
'prefix_indexes' => true,
// 'encrypt' => env('DB_ENCRYPT', 'yes'),
// 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'),
],
],
/*
|--------------------------------------------------------------------------
| Migration Repository Table
|--------------------------------------------------------------------------
|
| This table keeps track of all the migrations that have already run for
| your application. Using this information, we can determine which of
| the migrations on disk haven't actually been run on the database.
|
*/
'migrations' => [
'table' => 'migrations',
'update_date_on_publish' => true,
],
/*
|--------------------------------------------------------------------------
| Redis Databases
|--------------------------------------------------------------------------
|
| Redis is an open source, fast, and advanced key-value store that also
| provides a richer body of commands than a typical key-value system
| such as Memcached. You may define your connection settings here.
|
*/
'redis' => [
'client' => env('REDIS_CLIENT', 'phpredis'),
'options' => [
'cluster' => env('REDIS_CLUSTER', 'redis'),
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
'persistent' => env('REDIS_PERSISTENT', false),
],
'default' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'username' => env('REDIS_USERNAME'),
'password' => env('REDIS_PASSWORD'),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_DB', '0'),
],
'cache' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'username' => env('REDIS_USERNAME'),
'password' => env('REDIS_PASSWORD'),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_CACHE_DB', '1'),
],
],
];

80
config/filesystems.php Normal file
View File

@ -0,0 +1,80 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Filesystem Disk
|--------------------------------------------------------------------------
|
| Here you may specify the default filesystem disk that should be used
| by the framework. The "local" disk, as well as a variety of cloud
| based disks are available to your application for file storage.
|
*/
'default' => env('FILESYSTEM_DISK', 'local'),
/*
|--------------------------------------------------------------------------
| Filesystem Disks
|--------------------------------------------------------------------------
|
| Below you may configure as many filesystem disks as necessary, and you
| may even configure multiple disks for the same driver. Examples for
| most supported storage drivers are configured here for reference.
|
| Supported drivers: "local", "ftp", "sftp", "s3"
|
*/
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app/private'),
'serve' => true,
'throw' => false,
'report' => false,
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
'throw' => false,
'report' => false,
],
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
'endpoint' => env('AWS_ENDPOINT'),
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
'throw' => false,
'report' => false,
],
],
/*
|--------------------------------------------------------------------------
| Symbolic Links
|--------------------------------------------------------------------------
|
| Here you may configure the symbolic links that will be created when the
| `storage:link` Artisan command is executed. The array keys should be
| the locations of the links and the values should be their targets.
|
*/
'links' => [
public_path('storage') => storage_path('app/public'),
],
];

132
config/logging.php Normal file
View File

@ -0,0 +1,132 @@
<?php
use Monolog\Handler\NullHandler;
use Monolog\Handler\StreamHandler;
use Monolog\Handler\SyslogUdpHandler;
use Monolog\Processor\PsrLogMessageProcessor;
return [
/*
|--------------------------------------------------------------------------
| Default Log Channel
|--------------------------------------------------------------------------
|
| This option defines the default log channel that is utilized to write
| messages to your logs. The value provided here should match one of
| the channels present in the list of "channels" configured below.
|
*/
'default' => env('LOG_CHANNEL', 'stack'),
/*
|--------------------------------------------------------------------------
| Deprecations Log Channel
|--------------------------------------------------------------------------
|
| This option controls the log channel that should be used to log warnings
| regarding deprecated PHP and library features. This allows you to get
| your application ready for upcoming major versions of dependencies.
|
*/
'deprecations' => [
'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
'trace' => env('LOG_DEPRECATIONS_TRACE', false),
],
/*
|--------------------------------------------------------------------------
| Log Channels
|--------------------------------------------------------------------------
|
| Here you may configure the log channels for your application. Laravel
| utilizes the Monolog PHP logging library, which includes a variety
| of powerful log handlers and formatters that you're free to use.
|
| Available drivers: "single", "daily", "slack", "syslog",
| "errorlog", "monolog", "custom", "stack"
|
*/
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => explode(',', env('LOG_STACK', 'single')),
'ignore_exceptions' => false,
],
'single' => [
'driver' => 'single',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
'replace_placeholders' => true,
],
'daily' => [
'driver' => 'daily',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
'days' => env('LOG_DAILY_DAYS', 14),
'replace_placeholders' => true,
],
'slack' => [
'driver' => 'slack',
'url' => env('LOG_SLACK_WEBHOOK_URL'),
'username' => env('LOG_SLACK_USERNAME', 'Laravel Log'),
'emoji' => env('LOG_SLACK_EMOJI', ':boom:'),
'level' => env('LOG_LEVEL', 'critical'),
'replace_placeholders' => true,
],
'papertrail' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class),
'handler_with' => [
'host' => env('PAPERTRAIL_URL'),
'port' => env('PAPERTRAIL_PORT'),
'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'),
],
'processors' => [PsrLogMessageProcessor::class],
],
'stderr' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => StreamHandler::class,
'formatter' => env('LOG_STDERR_FORMATTER'),
'with' => [
'stream' => 'php://stderr',
],
'processors' => [PsrLogMessageProcessor::class],
],
'syslog' => [
'driver' => 'syslog',
'level' => env('LOG_LEVEL', 'debug'),
'facility' => env('LOG_SYSLOG_FACILITY', LOG_USER),
'replace_placeholders' => true,
],
'errorlog' => [
'driver' => 'errorlog',
'level' => env('LOG_LEVEL', 'debug'),
'replace_placeholders' => true,
],
'null' => [
'driver' => 'monolog',
'handler' => NullHandler::class,
],
'emergency' => [
'path' => storage_path('logs/laravel.log'),
],
],
];

116
config/mail.php Normal file
View File

@ -0,0 +1,116 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Mailer
|--------------------------------------------------------------------------
|
| This option controls the default mailer that is used to send all email
| messages unless another mailer is explicitly specified when sending
| the message. All additional mailers can be configured within the
| "mailers" array. Examples of each type of mailer are provided.
|
*/
'default' => env('MAIL_MAILER', 'log'),
/*
|--------------------------------------------------------------------------
| Mailer Configurations
|--------------------------------------------------------------------------
|
| Here you may configure all of the mailers used by your application plus
| their respective settings. Several examples have been configured for
| you and you are free to add your own as your application requires.
|
| Laravel supports a variety of mail "transport" drivers that can be used
| when delivering an email. You may specify which one you're using for
| your mailers below. You may also add additional mailers if needed.
|
| Supported: "smtp", "sendmail", "mailgun", "ses", "ses-v2",
| "postmark", "resend", "log", "array",
| "failover", "roundrobin"
|
*/
'mailers' => [
'smtp' => [
'transport' => 'smtp',
'scheme' => env('MAIL_SCHEME'),
'url' => env('MAIL_URL'),
'host' => env('MAIL_HOST', '127.0.0.1'),
'port' => env('MAIL_PORT', 2525),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'timeout' => null,
'local_domain' => env('MAIL_EHLO_DOMAIN', parse_url(env('APP_URL', 'http://localhost'), PHP_URL_HOST)),
],
'ses' => [
'transport' => 'ses',
],
'postmark' => [
'transport' => 'postmark',
// 'message_stream_id' => env('POSTMARK_MESSAGE_STREAM_ID'),
// 'client' => [
// 'timeout' => 5,
// ],
],
'resend' => [
'transport' => 'resend',
],
'sendmail' => [
'transport' => 'sendmail',
'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'),
],
'log' => [
'transport' => 'log',
'channel' => env('MAIL_LOG_CHANNEL'),
],
'array' => [
'transport' => 'array',
],
'failover' => [
'transport' => 'failover',
'mailers' => [
'smtp',
'log',
],
],
'roundrobin' => [
'transport' => 'roundrobin',
'mailers' => [
'ses',
'postmark',
],
],
],
/*
|--------------------------------------------------------------------------
| Global "From" Address
|--------------------------------------------------------------------------
|
| You may wish for all emails sent by your application to be sent from
| the same address. Here you may specify a name and address that is
| used globally for all emails that are sent by your application.
|
*/
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
'name' => env('MAIL_FROM_NAME', 'Example'),
],
];

112
config/queue.php Normal file
View File

@ -0,0 +1,112 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Queue Connection Name
|--------------------------------------------------------------------------
|
| Laravel's queue supports a variety of backends via a single, unified
| API, giving you convenient access to each backend using identical
| syntax for each. The default queue connection is defined below.
|
*/
'default' => env('QUEUE_CONNECTION', 'database'),
/*
|--------------------------------------------------------------------------
| Queue Connections
|--------------------------------------------------------------------------
|
| Here you may configure the connection options for every queue backend
| used by your application. An example configuration is provided for
| each backend supported by Laravel. You're also free to add more.
|
| Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null"
|
*/
'connections' => [
'sync' => [
'driver' => 'sync',
],
'database' => [
'driver' => 'database',
'connection' => env('DB_QUEUE_CONNECTION'),
'table' => env('DB_QUEUE_TABLE', 'jobs'),
'queue' => env('DB_QUEUE', 'default'),
'retry_after' => (int) env('DB_QUEUE_RETRY_AFTER', 90),
'after_commit' => false,
],
'beanstalkd' => [
'driver' => 'beanstalkd',
'host' => env('BEANSTALKD_QUEUE_HOST', 'localhost'),
'queue' => env('BEANSTALKD_QUEUE', 'default'),
'retry_after' => (int) env('BEANSTALKD_QUEUE_RETRY_AFTER', 90),
'block_for' => 0,
'after_commit' => false,
],
'sqs' => [
'driver' => 'sqs',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
'queue' => env('SQS_QUEUE', 'default'),
'suffix' => env('SQS_SUFFIX'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
'after_commit' => false,
],
'redis' => [
'driver' => 'redis',
'connection' => env('REDIS_QUEUE_CONNECTION', 'default'),
'queue' => env('REDIS_QUEUE', 'default'),
'retry_after' => (int) env('REDIS_QUEUE_RETRY_AFTER', 90),
'block_for' => null,
'after_commit' => false,
],
],
/*
|--------------------------------------------------------------------------
| Job Batching
|--------------------------------------------------------------------------
|
| The following options configure the database and table that store job
| batching information. These options can be updated to any database
| connection and table which has been defined by your application.
|
*/
'batching' => [
'database' => env('DB_CONNECTION', 'sqlite'),
'table' => 'job_batches',
],
/*
|--------------------------------------------------------------------------
| Failed Queue Jobs
|--------------------------------------------------------------------------
|
| These options configure the behavior of failed queue job logging so you
| can control how and where failed jobs are stored. Laravel ships with
| support for storing failed jobs in a simple file or in a database.
|
| Supported drivers: "database-uuids", "dynamodb", "file", "null"
|
*/
'failed' => [
'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'),
'database' => env('DB_CONNECTION', 'sqlite'),
'table' => 'failed_jobs',
],
];

83
config/sanctum.php Normal file
View File

@ -0,0 +1,83 @@
<?php
use Laravel\Sanctum\Sanctum;
return [
/*
|--------------------------------------------------------------------------
| Stateful Domains
|--------------------------------------------------------------------------
|
| Requests from the following domains / hosts will receive stateful API
| authentication cookies. Typically, these should include your local
| and production domains which access your API via a frontend SPA.
|
*/
'stateful' => explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf(
'%s%s',
'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1',
Sanctum::currentApplicationUrlWithPort()
))),
/*
|--------------------------------------------------------------------------
| Sanctum Guards
|--------------------------------------------------------------------------
|
| This array contains the authentication guards that will be checked when
| Sanctum is trying to authenticate a request. If none of these guards
| are able to authenticate the request, Sanctum will use the bearer
| token that's present on an incoming request for authentication.
|
*/
'guard' => ['web'],
/*
|--------------------------------------------------------------------------
| Expiration Minutes
|--------------------------------------------------------------------------
|
| This value controls the number of minutes until an issued token will be
| considered expired. This will override any values set in the token's
| "expires_at" attribute, but first-party sessions are not affected.
|
*/
'expiration' => null,
/*
|--------------------------------------------------------------------------
| Token Prefix
|--------------------------------------------------------------------------
|
| Sanctum can prefix new tokens in order to take advantage of numerous
| security scanning initiatives maintained by open source platforms
| that notify developers if they commit tokens into repositories.
|
| See: https://docs.github.com/en/code-security/secret-scanning/about-secret-scanning
|
*/
'token_prefix' => env('SANCTUM_TOKEN_PREFIX', ''),
/*
|--------------------------------------------------------------------------
| Sanctum Middleware
|--------------------------------------------------------------------------
|
| When authenticating your first-party SPA with Sanctum you may need to
| customize some of the middleware Sanctum uses while processing the
| request. You may change the middleware listed below as required.
|
*/
'middleware' => [
'authenticate_session' => Laravel\Sanctum\Http\Middleware\AuthenticateSession::class,
'encrypt_cookies' => Illuminate\Cookie\Middleware\EncryptCookies::class,
'validate_csrf_token' => Illuminate\Foundation\Http\Middleware\ValidateCsrfToken::class,
],
];

38
config/services.php Normal file
View File

@ -0,0 +1,38 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Third Party Services
|--------------------------------------------------------------------------
|
| This file is for storing the credentials for third party services such
| as Mailgun, Postmark, AWS and more. This file provides the de facto
| location for this type of information, allowing packages to have
| a conventional file to locate the various service credentials.
|
*/
'postmark' => [
'token' => env('POSTMARK_TOKEN'),
],
'ses' => [
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
],
'resend' => [
'key' => env('RESEND_KEY'),
],
'slack' => [
'notifications' => [
'bot_user_oauth_token' => env('SLACK_BOT_USER_OAUTH_TOKEN'),
'channel' => env('SLACK_BOT_USER_DEFAULT_CHANNEL'),
],
],
];

217
config/session.php Normal file
View File

@ -0,0 +1,217 @@
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Session Driver
|--------------------------------------------------------------------------
|
| This option determines the default session driver that is utilized for
| incoming requests. Laravel supports a variety of storage options to
| persist session data. Database storage is a great default choice.
|
| Supported: "file", "cookie", "database", "apc",
| "memcached", "redis", "dynamodb", "array"
|
*/
'driver' => env('SESSION_DRIVER', 'database'),
/*
|--------------------------------------------------------------------------
| Session Lifetime
|--------------------------------------------------------------------------
|
| Here you may specify the number of minutes that you wish the session
| to be allowed to remain idle before it expires. If you want them
| to expire immediately when the browser is closed then you may
| indicate that via the expire_on_close configuration option.
|
*/
'lifetime' => (int) env('SESSION_LIFETIME', 120),
'expire_on_close' => env('SESSION_EXPIRE_ON_CLOSE', false),
/*
|--------------------------------------------------------------------------
| Session Encryption
|--------------------------------------------------------------------------
|
| This option allows you to easily specify that all of your session data
| should be encrypted before it's stored. All encryption is performed
| automatically by Laravel and you may use the session like normal.
|
*/
'encrypt' => env('SESSION_ENCRYPT', false),
/*
|--------------------------------------------------------------------------
| Session File Location
|--------------------------------------------------------------------------
|
| When utilizing the "file" session driver, the session files are placed
| on disk. The default storage location is defined here; however, you
| are free to provide another location where they should be stored.
|
*/
'files' => storage_path('framework/sessions'),
/*
|--------------------------------------------------------------------------
| Session Database Connection
|--------------------------------------------------------------------------
|
| When using the "database" or "redis" session drivers, you may specify a
| connection that should be used to manage these sessions. This should
| correspond to a connection in your database configuration options.
|
*/
'connection' => env('SESSION_CONNECTION'),
/*
|--------------------------------------------------------------------------
| Session Database Table
|--------------------------------------------------------------------------
|
| When using the "database" session driver, you may specify the table to
| be used to store sessions. Of course, a sensible default is defined
| for you; however, you're welcome to change this to another table.
|
*/
'table' => env('SESSION_TABLE', 'sessions'),
/*
|--------------------------------------------------------------------------
| Session Cache Store
|--------------------------------------------------------------------------
|
| When using one of the framework's cache driven session backends, you may
| define the cache store which should be used to store the session data
| between requests. This must match one of your defined cache stores.
|
| Affects: "apc", "dynamodb", "memcached", "redis"
|
*/
'store' => env('SESSION_STORE'),
/*
|--------------------------------------------------------------------------
| Session Sweeping Lottery
|--------------------------------------------------------------------------
|
| Some session drivers must manually sweep their storage location to get
| rid of old sessions from storage. Here are the chances that it will
| happen on a given request. By default, the odds are 2 out of 100.
|
*/
'lottery' => [2, 100],
/*
|--------------------------------------------------------------------------
| Session Cookie Name
|--------------------------------------------------------------------------
|
| Here you may change the name of the session cookie that is created by
| the framework. Typically, you should not need to change this value
| since doing so does not grant a meaningful security improvement.
|
*/
'cookie' => env(
'SESSION_COOKIE',
Str::slug(env('APP_NAME', 'laravel'), '_').'_session'
),
/*
|--------------------------------------------------------------------------
| Session Cookie Path
|--------------------------------------------------------------------------
|
| The session cookie path determines the path for which the cookie will
| be regarded as available. Typically, this will be the root path of
| your application, but you're free to change this when necessary.
|
*/
'path' => env('SESSION_PATH', '/'),
/*
|--------------------------------------------------------------------------
| Session Cookie Domain
|--------------------------------------------------------------------------
|
| This value determines the domain and subdomains the session cookie is
| available to. By default, the cookie will be available to the root
| domain and all subdomains. Typically, this shouldn't be changed.
|
*/
'domain' => env('SESSION_DOMAIN'),
/*
|--------------------------------------------------------------------------
| HTTPS Only Cookies
|--------------------------------------------------------------------------
|
| By setting this option to true, session cookies will only be sent back
| to the server if the browser has a HTTPS connection. This will keep
| the cookie from being sent to you when it can't be done securely.
|
*/
'secure' => env('SESSION_SECURE_COOKIE'),
/*
|--------------------------------------------------------------------------
| HTTP Access Only
|--------------------------------------------------------------------------
|
| Setting this value to true will prevent JavaScript from accessing the
| value of the cookie and the cookie will only be accessible through
| the HTTP protocol. It's unlikely you should disable this option.
|
*/
'http_only' => env('SESSION_HTTP_ONLY', true),
/*
|--------------------------------------------------------------------------
| Same-Site Cookies
|--------------------------------------------------------------------------
|
| This option determines how your cookies behave when cross-site requests
| take place, and can be used to mitigate CSRF attacks. By default, we
| will set this value to "lax" to permit secure cross-site requests.
|
| See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value
|
| Supported: "lax", "strict", "none", null
|
*/
'same_site' => env('SESSION_SAME_SITE', 'lax'),
/*
|--------------------------------------------------------------------------
| Partitioned Cookies
|--------------------------------------------------------------------------
|
| Setting this value to true will tie the cookie to the top-level site for
| a cross-site context. Partitioned cookies are accepted by the browser
| when flagged "secure" and the Same-Site attribute is set to "none".
|
*/
'partitioned' => env('SESSION_PARTITIONED_COOKIE', false),
];

1
database/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.sqlite*

View File

@ -0,0 +1,44 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\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 [
'username' => fake()->username(),
'email' => fake()->unique()->safeEmail(),
'email_verified_at' => now(),
'password' => static::$password ??= Hash::make('password'),
'remember_token' => Str::random(10),
];
}
/**
* Indicate that the model's email address should be unverified.
*/
public function unverified(): static
{
return $this->state(fn (array $attributes) => [
'email_verified_at' => null,
]);
}
}

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePasswordResetsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('password_resets', function (Blueprint $table) {
$table->string('email')->index();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('password_resets');
}
}

View File

@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateFailedJobsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('failed_jobs', function (Blueprint $table) {
$table->id();
$table->string('uuid')->unique();
$table->text('connection');
$table->text('queue');
$table->longText('payload');
$table->longText('exception');
$table->timestamp('failed_at')->useCurrent();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('failed_jobs');
}
}

View File

@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePersonalAccessTokensTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('personal_access_tokens', function (Blueprint $table) {
$table->id();
$table->morphs('tokenable');
$table->string('name');
$table->string('token', 64)->unique();
$table->text('abilities')->nullable();
$table->timestamp('last_used_at')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('personal_access_tokens');
}
}

View File

@ -0,0 +1,31 @@
<?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('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('sessions');
}
};

View File

@ -0,0 +1,243 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up()
{
// Base tables without FKs
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('name', 100);
$table->string('email', 100)->unique();
$table->string('password');
$table->enum('role', ['admin','peserta','juri']);
$table->timestamps();
});
Schema::create('level_cu', function (Blueprint $table) {
$table->char('level', 1)->primary();
$table->string('description', 50);
});
Schema::create('bidang_cu', function (Blueprint $table) {
$table->tinyIncrements('id');
$table->string('nama', 50);
});
Schema::create('bobot_kriteria', function (Blueprint $table) {
$table->enum('nama_kriteria', ['CU','PI','BI'])->primary();
$table->decimal('bobot', 3, 2);
});
Schema::create('schedules', function (Blueprint $table) {
$table->id();
$table->date('date_from');
$table->date('date_to')->nullable();
$table->string('activity');
$table->integer('order')->default(0);
$table->timestamps();
});
Schema::create('hero_slides', function (Blueprint $table) {
$table->id();
$table->string('title');
$table->string('subtitle')->nullable();
$table->string('image_path');
$table->string('button_text')->nullable();
$table->string('button_url')->nullable();
$table->integer('order')->default(0);
$table->timestamps();
});
Schema::create('requirements', function (Blueprint $table) {
$table->id();
$table->string('text');
$table->integer('order')->default(0);
$table->timestamps();
});
Schema::create('purposes', function (Blueprint $table) {
$table->id();
$table->string('title');
$table->text('description');
$table->string('icon_path')->nullable();
$table->integer('order')->default(0);
$table->timestamps();
});
// Profiles (depends on users)
Schema::create('admin_profile', function (Blueprint $table) {
$table->unsignedBigInteger('user_id')->primary();
$table->string('no_hp', 20)->nullable();
$table->string('jabatan', 100)->nullable();
$table->string('instansi', 150)->nullable();
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
});
Schema::create('juri_profile', function (Blueprint $table) {
$table->unsignedBigInteger('user_id')->primary();
$table->string('no_hp', 20)->nullable();
$table->string('instansi', 150)->nullable();
$table->string('bidang_keahlian', 100)->nullable();
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
});
Schema::create('peserta_profile', function (Blueprint $table) {
$table->unsignedBigInteger('user_id')->primary();
$table->string('nik', 20);
$table->string('tempat_lahir', 50);
$table->date('tanggal_lahir');
$table->string('nim', 20);
$table->string('no_hp', 20);
$table->enum('program_pendidikan', ['Diploma','Sarjana']);
$table->string('program_studi', 100);
$table->tinyInteger('semester_ke');
$table->decimal('ipk', 3, 2);
$table->string('kode_pt', 10);
$table->string('wilayah_lldikti', 50);
$table->string('perguruan_tinggi', 150);
$table->text('alamat_pt');
$table->string('telp_pt', 20);
$table->string('email_pt', 100);
$table->string('pas_foto');
$table->string('surat_pengantar');
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
});
// CU and related
Schema::create('kategori_cu', function (Blueprint $table) {
$table->id();
$table->unsignedTinyInteger('bidang_id');
$table->string('wujud_cu', 100);
$table->string('kode', 4);
$table->char('level_id', 1);
$table->decimal('skor', 5, 2);
$table->unique(['bidang_id','wujud_cu','level_id']);
$table->foreign('bidang_id')->references('id')->on('bidang_cu')->onDelete('cascade');
$table->foreign('level_id')->references('level')->on('level_cu')->onDelete('cascade');
});
Schema::create('cu_submission', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('peserta_id');
$table->unsignedBigInteger('kategori_cu_id');
$table->string('file_path');
$table->timestamp('submitted_at')->useCurrent();
$table->enum('status', ['pending','approved','rejected'])->default('pending');
$table->timestamp('reviewed_at')->nullable();
$table->text('comment')->nullable();
$table->decimal('skor', 5, 2)->nullable();
$table->foreign('peserta_id')->references('user_id')->on('peserta_profile')->onDelete('cascade');
$table->foreign('kategori_cu_id')->references('id')->on('kategori_cu')->onDelete('cascade');
});
Schema::create('cu_selection', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('submission_id')->unique()->nullable();
$table->unsignedBigInteger('peserta_id');
$table->char('level_id', 1);
$table->tinyInteger('selection_round')->default(1);
$table->enum('status_lolos', ['lolos','gagal','pending']);
$table->boolean('pending')->default(false);
$table->decimal('skor_cu', 5, 4)->default(0);
$table->timestamp('selected_at')->useCurrent();
$table->foreign('submission_id')->references('id')->on('cu_submission')->onDelete('cascade');
$table->foreign('peserta_id')->references('user_id')->on('peserta_profile')->onDelete('cascade');
$table->foreign('level_id')->references('level')->on('level_cu')->onDelete('cascade');
});
// PI/BI schedules and scoring
Schema::create('schedule_pi_bi', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('peserta_id');
$table->unsignedBigInteger('juri_id');
$table->date('tanggal');
$table->string('lokasi', 150);
$table->timestamp('created_at')->useCurrent();
$table->foreign('peserta_id')->references('user_id')->on('peserta_profile')->onDelete('cascade');
$table->foreign('juri_id')->references('user_id')->on('juri_profile')->onDelete('cascade');
});
Schema::create('schedule_pi_bi_juri', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('schedule_id');
$table->unsignedBigInteger('juri_id');
$table->timestamps();
$table->unique(['schedule_id','juri_id']);
$table->foreign('schedule_id')->references('id')->on('schedule_pi_bi')->onDelete('cascade');
$table->foreign('juri_id')->references('user_id')->on('juri_profile')->onDelete('cascade');
});
Schema::create('penilaian_bi_juri', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('schedule_id');
$table->decimal('content_score',5,2);
$table->decimal('accuracy_score',5,2);
$table->decimal('fluency_score',5,2);
$table->decimal('pronunciation_score',5,2);
$table->decimal('overall_perf_score',5,2);
$table->decimal('total_score',5,2)->nullable()->comment('Total skor BI (maks 100 poin)');
$table->timestamp('scored_at')->useCurrent();
$table->foreign('schedule_id')->references('id')->on('schedule_pi_bi')->onDelete('cascade');
});
Schema::create('penilaian_pi_juri', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('schedule_id');
$table->decimal('penyajian',5,2);
$table->decimal('substansi_masalah',5,2)->comment('Total dari semua aspek masalah (maks 20 poin)');
$table->decimal('substansi_solusi',5,2)->comment('Total dari semua aspek solusi (maks 35 poin)');
$table->decimal('kualitas_pi',5,2)->comment('Total kualitas inovasi (maks 30 poin)');
$table->decimal('total_score',5,2)->nullable()->comment('Total skor PI (maks 100 poin)');
$table->timestamp('scored_at')->useCurrent();
$table->foreign('schedule_id')->references('id')->on('schedule_pi_bi')->onDelete('cascade');
});
Schema::create('naskah_pi', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('peserta_id');
$table->string('judul')->nullable();
$table->text('abstrak')->nullable();
$table->longText('isi')->nullable();
$table->timestamp('tanggal_upload')->useCurrent();
$table->foreign('peserta_id')->references('user_id')->on('peserta_profile')->onDelete('cascade');
});
Schema::create('penilaian_akhir', function (Blueprint $table) {
$table->unsignedBigInteger('peserta_id')->primary();
$table->decimal('skor_cu_normal', 6, 4);
$table->decimal('skor_pi_normal', 6, 4);
$table->decimal('skor_bi_normal', 6, 4);
$table->decimal('total_akhir', 6, 4);
$table->foreign('peserta_id')->references('user_id')->on('peserta_profile')->onDelete('cascade');
});
}
public function down()
{
Schema::dropIfExists('penilaian_akhir');
Schema::dropIfExists('naskah_pi');
Schema::dropIfExists('penilaian_pi_juri');
Schema::dropIfExists('penilaian_bi_juri');
Schema::dropIfExists('schedule_pi_bi_juri');
Schema::dropIfExists('schedule_pi_bi');
Schema::dropIfExists('cu_selection');
Schema::dropIfExists('cu_submission');
Schema::dropIfExists('kategori_cu');
Schema::dropIfExists('peserta_profile');
Schema::dropIfExists('juri_profile');
Schema::dropIfExists('admin_profile');
Schema::dropIfExists('purposes');
Schema::dropIfExists('requirements');
Schema::dropIfExists('hero_slides');
Schema::dropIfExists('schedules');
Schema::dropIfExists('bobot_kriteria');
Schema::dropIfExists('bidang_cu');
Schema::dropIfExists('level_cu');
Schema::dropIfExists('users');
}
};

View File

@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateHeroFeaturesTable extends Migration
{
public function up()
{
Schema::create('hero_features', function (Blueprint $table) {
$table->id();
// foreign key ke hero_slides.id
$table->foreignId('hero_slide_id')
->constrained('hero_slides')
->cascadeOnDelete();
$table->string('icon_class', 150);
$table->string('text', 255);
$table->integer('order')->default(0);
$table->timestamps();
});
}
public function down()
{
Schema::dropIfExists('hero_features');
}
}

View File

@ -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
{
public function up(): void
{
Schema::create('rekap_penilaian_tahunan', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('peserta_id');
$table->year('tahun');
$table->decimal('skor_cu_normal', 6, 4)->default(0);
$table->decimal('skor_pi_normal', 6, 4)->default(0);
$table->decimal('skor_bi_normal', 6, 4)->default(0);
$table->decimal('total_akhir', 6, 4)->default(0);
$table->enum('status_cu', ['lolos', 'gagal', 'pending'])->default('pending');
$table->unsignedTinyInteger('selection_round')->default(0);
$table->timestamps();
$table->unique(['peserta_id', 'tahun']);
$table->foreign('peserta_id')->references('user_id')->on('peserta_profile')->onDelete('cascade');
});
}
public function down(): void
{
Schema::dropIfExists('rekap_penilaian_tahunan');
}
};

View File

@ -0,0 +1,72 @@
<?php
// database/seeders/DatabaseSeeder.php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Hash;
class AllTablesSeeder extends Seeder
{
public function run()
{
// Users
DB::table('users')->insert([
['id' => 1, 'name' => 'Admin Utama', 'email' => 'admin@polije.ac.id', 'password' => Hash::make('admin'), 'role' => 'admin', 'created_at' => '2025-04-30 09:30:00', 'updated_at' => '2025-04-30 09:30:00'],
['id' => 2, 'name' => 'Mahasiswa Satu', 'email' => 'mhs1@polije.ac.id', 'password' => Hash::make('password'), 'role' => 'peserta', 'created_at' => '2025-04-30 09:30:00', 'updated_at' => '2025-04-30 09:30:00'],
['id' => 3, 'name' => 'Juri Satu', 'email' => 'juri1@univ.example', 'password' => Hash::make('password'), 'role' => 'juri', 'created_at' => '2025-04-30 09:30:00', 'updated_at' => '2025-04-30 09:30:00'],
]);
// Admin Profile
DB::table('admin_profile')->insert([
'user_id' => 1,
'no_hp' => '081234567890',
'jabatan' => 'Ketua Panitia',
'instansi' => 'Politeknik Negeri Jember',
]);
// Peserta Profile
DB::table('peserta_profile')->insert([
'user_id' => 2,
'nik' => '1234567890123456',
'tempat_lahir' => 'Jember',
'tanggal_lahir' => '2002-05-10',
'nim' => '2021101001',
'no_hp' => '082345678901',
'program_pendidikan'=> 'Sarjana',
'program_studi' => 'Teknik Informatika',
'semester_ke' => 6,
'ipk' => 3.75,
'kode_pt' => 'JBR001',
'wilayah_lldikti' => 'VII',
'perguruan_tinggi' => 'Politeknik Negeri Jember',
'alamat_pt' => 'Jl. Mastrip No.1, Jember',
'telp_pt' => '0331-123456',
'email_pt' => 'ti@polije.ac.id',
'pas_foto' => 'foto2.jpg',
'surat_pengantar' => 'sk2.pdf',
]);
// Juri Profile
DB::table('juri_profile')->insert([
'user_id' => 3,
'no_hp' => '083456789012',
'instansi' => 'Universitas Jember',
'bidang_keahlian' => 'Teknologi Informasi',
]);
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
DB::table('juri_profile')->where('user_id',3)->delete();
DB::table('peserta_profile')->where('user_id',2)->delete();
DB::table('admin_profile')->where('user_id',1)->delete();
DB::table('users')->whereIn('id',[1,2,3])->delete();
}
}

View File

@ -0,0 +1,26 @@
<?php
// database/seeders/DatabaseSeeder.php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
class DatabaseSeeder extends Seeder
{
public function run()
{
$this->call([
// AllTablesSeeder::class,
// UsersSeeder::class,
// HeroSlidesTableSeeder::class,
// HeroFeaturesTableSeeder::class,
// PurposesTableSeeder::class,
// RequirementsTableSeeder::class,
// SchedulesTableSeeder::class,
// PesertaDummySeeder::class,
RekapitulasiTahunanSeeder::class,
]);
}
}
// Compare this snippet from database/seeders/SchedulesTableSeeder.php:

View File

@ -0,0 +1,37 @@
<?php
// database/seeders/HeroFeaturesTableSeeder.php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class HeroFeaturesTableSeeder extends Seeder
{
public function run()
{
// Ambil semua slide
$slides = DB::table('hero_slides')->pluck('id');
foreach ($slides as $slideId) {
DB::table('hero_features')->insert([
[
'hero_slide_id' => $slideId,
'icon_class' => 'fa-solid fa-check-circle text-warning',
'text' => 'Fitur unggulan slide ' . $slideId . ' - poin A',
'order' => 1,
'created_at' => now(),
'updated_at' => now(),
],
[
'hero_slide_id' => $slideId,
'icon_class' => 'fa-solid fa-star text-warning',
'text' => 'Fitur unggulan slide ' . $slideId . ' - poin B',
'order' => 2,
'created_at' => now(),
'updated_at' => now(),
],
]);
}
}
}

View File

@ -0,0 +1,36 @@
<?php
// database/seeders/HeroSlidesTableSeeder.php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class HeroSlidesTableSeeder extends Seeder
{
public function run()
{
DB::table('hero_slides')->insert([
[
'title' => 'Selamat Datang di PILMAPRES POLIJE',
'subtitle' => 'Tunjukkan Prestasimu!',
'image_path' => 'hero/hero.png',
'button_text' => 'Daftar Sekarang',
'button_url' => '/register',
'order' => 1,
'created_at' => now(),
'updated_at' => now(),
],
[
'title' => 'Kembangkan Inovasi',
'subtitle' => 'Ajang Mahasiswa Berprestasi',
'image_path' => 'hero/gedkes.jpg',
'button_text' => 'Lihat Jadwal',
'button_url' => '#jadwal',
'order' => 2,
'created_at' => now(),
'updated_at' => now(),
],
]);
}
}

View File

@ -0,0 +1,67 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Hash;
use Carbon\Carbon;
class JuriSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
// Create three new juri users and their profiles
$juries = [
[
'name' => 'Juri Satu',
'email' => 'juri1@example.com',
'password' => Hash::make('password123'),
'no_hp' => '081234567890',
'instansi' => 'Universitas Negeri A',
'bidang_keahlian' => 'Teknologi Informasi',
],
[
'name' => 'Juri Dua',
'email' => 'juri2@example.com',
'password' => Hash::make('password123'),
'no_hp' => '081298765432',
'instansi' => 'Institut Teknologi B',
'bidang_keahlian' => 'Manajemen Agribisnis',
],
[
'name' => 'Juri Tiga',
'email' => 'juri3@example.com',
'password' => Hash::make('password123'),
'no_hp' => '081212345678',
'instansi' => 'Sekolah Tinggi C',
'bidang_keahlian' => 'Produksi Pertanian',
],
];
foreach ($juries as $j) {
// Insert into users table
$userId = DB::table('users')->insertGetId([
'name' => $j['name'],
'email' => $j['email'],
'password' => $j['password'],
'role' => 'juri',
'created_at' => Carbon::now(),
'updated_at' => Carbon::now(),
]);
// Insert into juri_profile table
DB::table('juri_profile')->insert([
'user_id' => $userId,
'no_hp' => $j['no_hp'],
'instansi' => $j['instansi'],
'bidang_keahlian' => $j['bidang_keahlian'],
]);
}
}
}

View File

@ -0,0 +1,61 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use App\Models\User;
use App\Models\PesertaProfile;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\DB;
class PesertaDummySeeder extends Seeder
{
public function run(): void
{
DB::statement('SET FOREIGN_KEY_CHECKS=0;');
DB::table('cu_selection')->delete();
DB::table('rekap_penilaian_tahunan')->delete();
DB::table('peserta_profile')->delete();
DB::table('users')->where('role', 'peserta')->delete();
DB::statement('SET FOREIGN_KEY_CHECKS=1;');
for ($year = 2019; $year <= 2024; $year++) {
for ($i = 20; $i <= 30; $i++) {
$id = ($year * 100) + $i;
$name = "Peserta $id";
$email = "peserta$id@example.com";
$user = User::create([
'id' => $id,
'name' => $name,
'email' => $email,
'password' => Hash::make('password'),
'role' => 'peserta',
]);
PesertaProfile::create([
'user_id' => $user->id,
'nik' => '3576' . str_pad($i, 8, '0', STR_PAD_LEFT),
'tempat_lahir' => 'Jember',
'tanggal_lahir' => now()->subYears(22)->format('Y-m-d'),
'nim' => "TI$id",
'no_hp' => '0812' . rand(10000000, 99999999),
'program_pendidikan' => 'Diploma4',
'program_studi' => 'Teknik Informatika',
'semester_ke' => rand(6, 8),
'ipk' => round(rand(300, 400) / 100, 2),
'kode_pt' => 'PNJ',
'wilayah_lldikti' => 'VII',
'perguruan_tinggi' => 'Politeknik Negeri Jember',
'alamat_pt' => 'Jl. Mastrip 01 Jember',
'telp_pt' => '0331-333222',
'email_pt' => 'info@polije.ac.id',
'pas_foto' => 'kakakaksaksjcjnajsa/akansjncajnjancjsncasj/acskancasjc.pdf',
'surat_pengantar' => 'kakakaksaksjcjnajsa/akansjncajnjancjsncasj/acskancasjc/surat_pengantar.pdf',
'jurusan' => 'Teknik Elektro',
]);
}
}
}
}

View File

@ -0,0 +1,40 @@
<?php
// database/seeders/PurposesTableSeeder.php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class PurposesTableSeeder extends Seeder
{
public function run()
{
DB::table('purposes')->insert([
[
'title' => 'Mendorong mahasiswa berinovasi',
'description' => 'Memberi ruang bagi ide dan kreativitas mahasiswa.',
'icon_path' => 'icons/innovation.png',
'order' => 1,
'created_at' => now(),
'updated_at' => now(),
],
[
'title' => 'Asah keterampilan kepemimpinan',
'description' => 'Mengembangkan jiwa pemimpin melalui kompetisi.',
'icon_path' => 'icons/leadership.png',
'order' => 2,
'created_at' => now(),
'updated_at' => now(),
],
[
'title' => 'Apresiasi prestasi unggulan',
'description' => 'Memberikan penghargaan bagi prestasi terbaik.',
'icon_path' => 'icons/award.png',
'order' => 3,
'created_at' => now(),
'updated_at' => now(),
],
]);
}
}

View File

@ -0,0 +1,43 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use App\Models\RekapPenilaianTahunan;
use Illuminate\Support\Facades\DB;
class RekapitulasiTahunanSeeder extends Seeder
{
public function run(): void
{
DB::table('rekap_penilaian_tahunan')->truncate();
$pesertaList = DB::table('peserta_profile')->pluck('user_id');
$grouped = $pesertaList->groupBy(fn($id) => substr($id, 0, 4));
foreach ($grouped as $tahun => $ids) {
$selectedIds = collect($ids)->take(10); // ambil 10 peserta per tahun
foreach ($selectedIds as $pid) {
$skorCU = round(mt_rand(10, 100) / 100, 4);
$skorPI = round(mt_rand(0, 100) / 100, 4);
$skorBI = round(mt_rand(0, 100) / 100, 4);
$total = round($skorCU * 0.4 + $skorPI * 0.3 + $skorBI * 0.3, 4);
RekapPenilaianTahunan::create([
'peserta_id' => $pid,
'tahun' => $tahun,
'skor_cu_normal' => $skorCU,
'skor_pi_normal' => $skorPI,
'skor_bi_normal' => $skorBI,
'total_akhir' => $total,
'status_cu' => $total >= 0.5 ? 'lolos' : 'gagal',
'selection_round' => 1,
'created_at' => now(),
'updated_at' => now(),
]);
}
}
}
}

View File

@ -0,0 +1,22 @@
<?php
// database/seeders/RequirementsTableSeeder.php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class RequirementsTableSeeder extends Seeder
{
public function run()
{
DB::table('requirements')->insert([
['text' => 'Terdaftar di PD-Dikti, aktif D3/D4 s.d. semester VI', 'order'=>1, 'created_at'=>now(), 'updated_at'=>now()],
['text' => 'Usia ≤22 tahun per 1 Jan 2025', 'order'=>2, 'created_at'=>now(), 'updated_at'=>now()],
['text' => 'Belum pernah finalis Nasional', 'order'=>3, 'created_at'=>now(), 'updated_at'=>now()],
['text' => 'IPK ≥3.5', 'order'=>4, 'created_at'=>now(), 'updated_at'=>now()],
['text' => 'Kemampuan bahasa Inggris', 'order'=>5, 'created_at'=>now(), 'updated_at'=>now()],
['text' => 'Surat pengantar Jurusan (max 2 peserta)', 'order'=>6, 'created_at'=>now(), 'updated_at'=>now()],
]);
}
}

View File

@ -0,0 +1,73 @@
<?php
// database/seeders/SchedulesTableSeeder.php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
use Carbon\Carbon;
class SchedulesTableSeeder extends Seeder
{
public function run()
{
DB::table('schedules')->insert([
[
'date_from' => '2025-03-04',
'date_to' => '2025-03-10',
'activity' => 'Pendaftaran & seleksi jurusan',
'order' => 1,
'created_at' => now(),
'updated_at' => now(),
],
[
'date_from' => '2025-03-12',
'date_to' => '2025-03-14',
'activity' => 'Seleksi administrasi internal',
'order' => 2,
'created_at' => now(),
'updated_at' => now(),
],
[
'date_from' => '2025-03-15',
'date_to' => '2025-03-15',
'activity' => 'Pengumuman 10 besar Polije',
'order' => 3,
'created_at' => now(),
'updated_at' => now(),
],
[
'date_from' => '2025-03-21',
'date_to' => '2025-03-23',
'activity' => 'Seleksi tingkat Polije',
'order' => 4,
'created_at' => now(),
'updated_at' => now(),
],
[
'date_from' => '2025-04-09',
'date_to' => '2025-04-30',
'activity' => 'BIMTEK/Pelatihan juara Polije',
'order' => 5,
'created_at' => now(),
'updated_at' => now(),
],
[
'date_from' => '2025-05-02',
'date_to' => '2025-05-12',
'activity' => 'Seleksi Wilayah',
'order' => 6,
'created_at' => now(),
'updated_at' => now(),
],
[
'date_from' => '2025-05-01',
'date_to' => '2025-07-31',
'activity' => 'PILMAPRES Nasional',
'order' => 7,
'created_at' => now(),
'updated_at' => now(),
],
]);
}
}

View File

@ -0,0 +1,38 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Hash;
class UsersSeeder extends Seeder
{
public function run(): void
{
DB::table('users')->insert([
'name' => 'Admin',
'username' => 'admin',
'email' => 'admin@gmail.com',
'password' => Hash::make('password'), // Menggunakan Hash untuk menyimpan password
'role' => 'admin',
]);
DB::table('users')->insert([
'name' => 'Mahasiswa',
'username' => 'mahasiswa',
'email' => 'mahasiswa@gmail.com',
'password' => Hash::make('password'),
'role' => 'peserta',
]);
DB::table('users')->insert([
'name' => 'Juri',
'username' => 'juri',
'email' => 'juri@gmail.com',
'password' => Hash::make('password'),
'role' => 'juri',
]);
}
}

BIN
laravel_coba Normal file

Binary file not shown.

16
package.json Normal file
View File

@ -0,0 +1,16 @@
{
"private": true,
"type": "module",
"scripts": {
"build": "vite build",
"dev": "vite"
},
"devDependencies": {
"@tailwindcss/vite": "^4.0.0",
"axios": "^1.7.4",
"concurrently": "^9.0.1",
"laravel-vite-plugin": "^1.2.0",
"tailwindcss": "^4.0.0",
"vite": "^6.0.11"
}
}

33
phpunit.xml Normal file
View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
>
<testsuites>
<testsuite name="Unit">
<directory>tests/Unit</directory>
</testsuite>
<testsuite name="Feature">
<directory>tests/Feature</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory>app</directory>
</include>
</source>
<php>
<env name="APP_ENV" value="testing"/>
<env name="APP_MAINTENANCE_DRIVER" value="file"/>
<env name="BCRYPT_ROUNDS" value="4"/>
<env name="CACHE_STORE" value="array"/>
<!-- <env name="DB_CONNECTION" value="sqlite"/> -->
<!-- <env name="DB_DATABASE" value=":memory:"/> -->
<env name="MAIL_MAILER" value="array"/>
<env name="PULSE_ENABLED" value="false"/>
<env name="QUEUE_CONNECTION" value="sync"/>
<env name="SESSION_DRIVER" value="array"/>
<env name="TELESCOPE_ENABLED" value="false"/>
</php>
</phpunit>

Some files were not shown because too many files have changed in this diff Show More