Upload project Laravel
This commit is contained in:
parent
c56027e195
commit
f564c456c3
|
|
@ -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
|
||||||
|
|
||||||
|
[compose.yaml]
|
||||||
|
indent_size = 4
|
||||||
|
|
@ -0,0 +1,61 @@
|
||||||
|
APP_NAME=SPKJurusanSMKN2Jember
|
||||||
|
APP_ENV=productionyes
|
||||||
|
APP_KEY=base64:y9Cc+F5m09y21HIo35CABepVzpR3vPRov2YbgyoyQqM=
|
||||||
|
APP_DEBUG=true
|
||||||
|
APP_URL=http://localhost:8000
|
||||||
|
|
||||||
|
APP_LOCALE=en
|
||||||
|
APP_FALLBACK_LOCALE=en
|
||||||
|
APP_FAKER_LOCALE=en_US
|
||||||
|
|
||||||
|
APP_MAINTENANCE_DRIVER=file
|
||||||
|
|
||||||
|
BCRYPT_ROUNDS=12
|
||||||
|
|
||||||
|
LOG_CHANNEL=stack
|
||||||
|
LOG_STACK=single
|
||||||
|
LOG_DEPRECATIONS_CHANNEL=null
|
||||||
|
LOG_LEVEL=debug
|
||||||
|
|
||||||
|
DB_CONNECTION=mysql
|
||||||
|
DB_HOST=localhost
|
||||||
|
DB_PORT=3306
|
||||||
|
DB_DATABASE=spk-saw3
|
||||||
|
DB_USERNAME=root
|
||||||
|
DB_PASSWORD=
|
||||||
|
|
||||||
|
SESSION_DRIVER=file
|
||||||
|
SESSION_LIFETIME=120
|
||||||
|
SESSION_ENCRYPT=false
|
||||||
|
SESSION_PATH=/
|
||||||
|
SESSION_DOMAIN=null
|
||||||
|
|
||||||
|
BROADCAST_CONNECTION=log
|
||||||
|
FILESYSTEM_DISK=local
|
||||||
|
QUEUE_CONNECTION=sync
|
||||||
|
|
||||||
|
CACHE_STORE=file
|
||||||
|
|
||||||
|
MEMCACHED_HOST=127.0.0.1
|
||||||
|
|
||||||
|
REDIS_CLIENT=phpredis
|
||||||
|
REDIS_HOST=127.0.0.1
|
||||||
|
REDIS_PASSWORD=null
|
||||||
|
REDIS_PORT=6379
|
||||||
|
|
||||||
|
MAIL_MAILER=smtp
|
||||||
|
MAIL_HOST=smtp.gmail.com
|
||||||
|
MAIL_PORT=587
|
||||||
|
MAIL_USERNAME=spksekolah@gmail.com
|
||||||
|
MAIL_PASSWORD=qluephltoolaomah
|
||||||
|
MAIL_ENCRYPTION=tls
|
||||||
|
MAIL_FROM_ADDRESS=spksekolah@gmail.com
|
||||||
|
MAIL_FROM_NAME="SPK SMKN 2 Jember"
|
||||||
|
|
||||||
|
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}"
|
||||||
|
|
@ -0,0 +1,65 @@
|
||||||
|
APP_NAME=Laravel
|
||||||
|
APP_ENV=local
|
||||||
|
APP_KEY=
|
||||||
|
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=sqlite
|
||||||
|
# DB_HOST=127.0.0.1
|
||||||
|
# DB_PORT=3306
|
||||||
|
# DB_DATABASE=laravel
|
||||||
|
# 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}"
|
||||||
|
|
@ -0,0 +1,61 @@
|
||||||
|
APP_NAME=SPKJurusanSMKN2Jember
|
||||||
|
APP_ENV=production
|
||||||
|
APP_KEY=base64:y9Cc+F5m09y21HIo35CABepVzpR3vPRov2YbgyoyQqM=
|
||||||
|
APP_DEBUG=true
|
||||||
|
APP_URL=https://ta.myhost.id/E31231003
|
||||||
|
|
||||||
|
APP_LOCALE=en
|
||||||
|
APP_FALLBACK_LOCALE=en
|
||||||
|
APP_FAKER_LOCALE=en_US
|
||||||
|
|
||||||
|
APP_MAINTENANCE_DRIVER=file
|
||||||
|
|
||||||
|
BCRYPT_ROUNDS=12
|
||||||
|
|
||||||
|
LOG_CHANNEL=stack
|
||||||
|
LOG_STACK=single
|
||||||
|
LOG_DEPRECATIONS_CHANNEL=null
|
||||||
|
LOG_LEVEL=debug
|
||||||
|
|
||||||
|
DB_CONNECTION=mysql
|
||||||
|
DB_HOST=localhost
|
||||||
|
DB_PORT=3306
|
||||||
|
DB_DATABASE=tamyhost_E31231003
|
||||||
|
DB_USERNAME=tamyhost_E31231003
|
||||||
|
DB_PASSWORD=MIF_E31231003
|
||||||
|
|
||||||
|
SESSION_DRIVER=file
|
||||||
|
SESSION_LIFETIME=120
|
||||||
|
SESSION_ENCRYPT=false
|
||||||
|
SESSION_PATH=/
|
||||||
|
SESSION_DOMAIN=null
|
||||||
|
|
||||||
|
BROADCAST_CONNECTION=log
|
||||||
|
FILESYSTEM_DISK=local
|
||||||
|
QUEUE_CONNECTION=sync
|
||||||
|
|
||||||
|
CACHE_STORE=file
|
||||||
|
|
||||||
|
MEMCACHED_HOST=127.0.0.1
|
||||||
|
|
||||||
|
REDIS_CLIENT=phpredis
|
||||||
|
REDIS_HOST=127.0.0.1
|
||||||
|
REDIS_PASSWORD=null
|
||||||
|
REDIS_PORT=6379
|
||||||
|
|
||||||
|
MAIL_MAILER=smtp
|
||||||
|
MAIL_HOST=mail.ta.myhost.id
|
||||||
|
MAIL_PORT=465
|
||||||
|
MAIL_USERNAME=e31231003@ta.myhost.id
|
||||||
|
MAIL_PASSWORD=MIF_E31231003
|
||||||
|
MAIL_ENCRYPTION=ssl
|
||||||
|
MAIL_FROM_ADDRESS=e31231003@ta.myhost.id
|
||||||
|
MAIL_FROM_NAME="SPK SMKN 2 Jember"
|
||||||
|
|
||||||
|
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}"
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?php
|
||||||
|
namespace App\Http\Controllers\Admin;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\{Siswa, GuruBk, Jurusan, Tes};
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
|
class DashboardController extends Controller
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$totalSiswa = Siswa::whereHas('user', fn($q) => $q->where('is_active', true))->count();
|
||||||
|
$totalGuruBk = GuruBk::whereHas('user', fn($q) => $q->where('is_active', true))->count();
|
||||||
|
$totalJurusan = Jurusan::where('is_active', true)->count();
|
||||||
|
$totalTes = Tes::count();
|
||||||
|
|
||||||
|
$recentGuruBk = GuruBk::with('user')->latest()->take(5)->get();
|
||||||
|
$recentSiswa = Siswa::with('user')->latest()->take(5)->get();
|
||||||
|
$jurusans = Jurusan::orderBy('nama_jurusan')->get();
|
||||||
|
|
||||||
|
$recentLogs = DB::table('activity_log')
|
||||||
|
->join('users', 'users.id', '=', 'activity_log.user_id')
|
||||||
|
->select('activity_log.*', 'users.nama as user_nama')
|
||||||
|
->orderByDesc('activity_log.created_at')
|
||||||
|
->take(8)->get();
|
||||||
|
|
||||||
|
return view('pages.admin.dashboard', compact(
|
||||||
|
'totalSiswa', 'totalGuruBk', 'totalJurusan', 'totalTes',
|
||||||
|
'recentGuruBk', 'recentSiswa', 'jurusans', 'recentLogs'
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,127 @@
|
||||||
|
<?php
|
||||||
|
// ============================================================
|
||||||
|
// FILE 1: app/Http/Controllers/Admin/GuruBkController.php
|
||||||
|
// FR-A-02, FR-A-03, FR-A-04, FR-A-05
|
||||||
|
// ============================================================
|
||||||
|
namespace App\Http\Controllers\Admin;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\User;
|
||||||
|
use App\Models\GuruBk;
|
||||||
|
use App\Models\Jurusan;
|
||||||
|
use App\Services\ActivityLogger;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
|
||||||
|
class GuruBkController extends Controller
|
||||||
|
{
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
$search = trim((string) $request->query('search'));
|
||||||
|
|
||||||
|
$guruBks = GuruBk::with(['user', 'jurusan'])
|
||||||
|
->when($search !== '', function ($query) use ($search) {
|
||||||
|
$query->where('nip', 'like', "%{$search}%")
|
||||||
|
->orWhereHas('user', function ($userQuery) use ($search) {
|
||||||
|
$userQuery->where('nama', 'like', "%{$search}%")
|
||||||
|
->orWhere('email', 'like', "%{$search}%");
|
||||||
|
})
|
||||||
|
->orWhereHas('jurusan', function ($jurusanQuery) use ($search) {
|
||||||
|
$jurusanQuery->where('nama_jurusan', 'like', "%{$search}%");
|
||||||
|
});
|
||||||
|
})
|
||||||
|
->latest()
|
||||||
|
->paginate(15);
|
||||||
|
|
||||||
|
return view('pages.admin.gurubk.index', compact('guruBks'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
$jurusans = Jurusan::where('is_active', true)->orderBy('nama_jurusan')->get();
|
||||||
|
return view('pages.admin.gurubk.create', compact('jurusans'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'nama' => 'required|string|max:120',
|
||||||
|
'email' => 'required|email|unique:users,email',
|
||||||
|
'nip' => 'required|string|max:30',
|
||||||
|
'jurusan_id' => 'nullable|exists:jurusan,id',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$roleId = \App\Models\Role::where('nama_role', 'guru_bk')->value('id');
|
||||||
|
|
||||||
|
$user = User::create([
|
||||||
|
'role_id' => $roleId,
|
||||||
|
'nama' => $request->nama,
|
||||||
|
'email' => $request->email,
|
||||||
|
'password_hash' => Hash::make('password123'), // default
|
||||||
|
'is_active' => true,
|
||||||
|
'must_change_password' => true,
|
||||||
|
]);
|
||||||
|
|
||||||
|
GuruBk::create([
|
||||||
|
'user_id' => $user->id,
|
||||||
|
'nip' => $request->nip,
|
||||||
|
'jurusan_id' => $request->jurusan_id,
|
||||||
|
]);
|
||||||
|
|
||||||
|
ActivityLogger::log('Admin tambah Guru BK: ' . $request->nama);
|
||||||
|
|
||||||
|
return redirect()->route('admin.gurubk.index')
|
||||||
|
->with('success', "Akun Guru BK {$request->nama} berhasil dibuat! Password default: password123");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit($id)
|
||||||
|
{
|
||||||
|
$guruBk = GuruBk::with(['user', 'jurusan'])->findOrFail($id);
|
||||||
|
$jurusans = Jurusan::where('is_active', true)->orderBy('nama_jurusan')->get();
|
||||||
|
return view('pages.admin.gurubk.edit', compact('guruBk', 'jurusans'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
$guruBk = GuruBk::with('user')->findOrFail($id);
|
||||||
|
|
||||||
|
$request->validate([
|
||||||
|
'nama' => 'required|string|max:120',
|
||||||
|
'email' => 'required|email|unique:users,email,'.$guruBk->user_id,
|
||||||
|
'nip' => 'required|string|max:30',
|
||||||
|
'jurusan_id' => 'nullable|exists:jurusan,id',
|
||||||
|
'password' => 'nullable|string|min:8',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$guruBk->user->update([
|
||||||
|
'nama' => $request->nama,
|
||||||
|
'email' => $request->email,
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($request->filled('password')) {
|
||||||
|
$guruBk->user->update([
|
||||||
|
'password_hash' => Hash::make($request->password),
|
||||||
|
'must_change_password' => true,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$guruBk->update([
|
||||||
|
'nip' => $request->nip,
|
||||||
|
'jurusan_id' => $request->jurusan_id,
|
||||||
|
]);
|
||||||
|
|
||||||
|
ActivityLogger::log('Admin edit Guru BK: ' . $request->nama);
|
||||||
|
|
||||||
|
return redirect()->route('admin.gurubk.index')
|
||||||
|
->with('success', "Data Guru BK {$request->nama} berhasil diperbarui!");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function toggleStatus($id)
|
||||||
|
{
|
||||||
|
$guruBk = GuruBk::with('user')->findOrFail($id);
|
||||||
|
$guruBk->user->update(['is_active' => !$guruBk->user->is_active]);
|
||||||
|
$status = $guruBk->user->is_active ? 'diaktifkan' : 'dinonaktifkan';
|
||||||
|
ActivityLogger::log("Admin {$status} Guru BK: {$guruBk->user->nama}");
|
||||||
|
return redirect()->back()->with('success', "Akun Guru BK berhasil {$status}.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,385 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Admin;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\Jurusan;
|
||||||
|
use App\Models\Kriteria;
|
||||||
|
use App\Models\JurusanKriteria;
|
||||||
|
use App\Models\Penyakit;
|
||||||
|
use App\Services\ActivityLogger;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
|
class JurusanAdminController extends Controller
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$jurusans = Jurusan::withCount(['artikelJurusan', 'prospekKerja'])
|
||||||
|
->orderBy('nama_jurusan')
|
||||||
|
->get();
|
||||||
|
|
||||||
|
return view('pages.admin.jurusan.index', compact('jurusans'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
$kriterias = Kriteria::where('is_active', true)
|
||||||
|
->orderBy('kode_kriteria')
|
||||||
|
->get();
|
||||||
|
|
||||||
|
$bobotMap = [];
|
||||||
|
$aturanMap = [];
|
||||||
|
$penyakits = Penyakit::where('is_active', true)
|
||||||
|
->orderBy('nama_penyakit')
|
||||||
|
->get();
|
||||||
|
$penyakitTerlarangIds = [];
|
||||||
|
|
||||||
|
return view('pages.admin.jurusan.create', compact('kriterias', 'bobotMap', 'aturanMap', 'penyakits', 'penyakitTerlarangIds'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$kriterias = Kriteria::where('is_active', true)
|
||||||
|
->orderBy('kode_kriteria')
|
||||||
|
->get();
|
||||||
|
|
||||||
|
$rules = [
|
||||||
|
'nama_jurusan' => 'required|string|max:100|unique:jurusan,nama_jurusan',
|
||||||
|
'is_active' => 'required|boolean',
|
||||||
|
'bobot' => 'required|array',
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($kriterias as $kriteria) {
|
||||||
|
$rules["bobot.{$kriteria->id}"] = 'required|numeric|min:0|max:1';
|
||||||
|
|
||||||
|
if ($this->isKriteriaPenyakit($kriteria)) {
|
||||||
|
$rules["wajib_lolos.{$kriteria->id}"] = 'nullable|boolean';
|
||||||
|
} elseif ($this->isKriteriaWajibLolos($kriteria)) {
|
||||||
|
$maxNilai = 100;
|
||||||
|
if ($kriteria->kode_kriteria === 'C6') $maxNilai = 1;
|
||||||
|
|
||||||
|
$rules["wajib_lolos.{$kriteria->id}"] = 'nullable|boolean';
|
||||||
|
$rules["nilai_min.{$kriteria->id}"] = "nullable|numeric|min:0|max:{$maxNilai}";
|
||||||
|
$rules["nilai_max.{$kriteria->id}"] = "nullable|numeric|min:0|max:{$maxNilai}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$rules['penyakit_larangan'] = 'nullable|array';
|
||||||
|
$rules['penyakit_larangan.*'] = 'exists:penyakit,id';
|
||||||
|
|
||||||
|
$request->validate($rules);
|
||||||
|
|
||||||
|
if ($errors = $this->validateAturanWajibLolos($request, $kriterias)) {
|
||||||
|
return back()->withErrors($errors)->withInput();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((int) $request->is_active === 1 && !$this->isBobotValid($request->bobot)) {
|
||||||
|
return back()
|
||||||
|
->withErrors([
|
||||||
|
'bobot' => 'Jurusan tidak dapat dibuat aktif karena bobot kriteria belum lengkap atau total bobot tidak sama dengan 1.00.'
|
||||||
|
])
|
||||||
|
->withInput();
|
||||||
|
}
|
||||||
|
|
||||||
|
DB::transaction(function () use ($request, $kriterias) {
|
||||||
|
$jurusan = Jurusan::create([
|
||||||
|
'nama_jurusan' => $request->nama_jurusan,
|
||||||
|
'is_active' => $request->is_active,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$insertData = [];
|
||||||
|
|
||||||
|
foreach ($kriterias as $kriteria) {
|
||||||
|
$insertData[] = [
|
||||||
|
'jurusan_id' => $jurusan->id,
|
||||||
|
'kriteria_id' => $kriteria->id,
|
||||||
|
'bobot' => (float) ($request->bobot[$kriteria->id] ?? 0),
|
||||||
|
'wajib_lolos' => $this->isKriteriaWajibLolos($kriteria)
|
||||||
|
? $request->boolean("wajib_lolos.{$kriteria->id}")
|
||||||
|
: false,
|
||||||
|
'nilai_min' => $this->nilaiMinUntukKriteria($request, $kriteria),
|
||||||
|
'nilai_max' => $this->nilaiMaxUntukKriteria($request, $kriteria),
|
||||||
|
'created_at' => now(),
|
||||||
|
'updated_at' => now(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($insertData)) {
|
||||||
|
JurusanKriteria::upsert(
|
||||||
|
$insertData,
|
||||||
|
['jurusan_id', 'kriteria_id'],
|
||||||
|
['bobot', 'wajib_lolos', 'nilai_min', 'nilai_max', 'updated_at']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$jurusan->penyakit()->sync($request->input('penyakit_larangan', []));
|
||||||
|
});
|
||||||
|
|
||||||
|
ActivityLogger::log('Admin tambah jurusan: ' . $request->nama_jurusan);
|
||||||
|
|
||||||
|
return redirect()->route('admin.jurusan.index')
|
||||||
|
->with('success', "Jurusan {$request->nama_jurusan} berhasil ditambahkan!");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit($id)
|
||||||
|
{
|
||||||
|
$jurusan = Jurusan::findOrFail($id);
|
||||||
|
|
||||||
|
$kriterias = Kriteria::where('is_active', true)
|
||||||
|
->orderBy('kode_kriteria')
|
||||||
|
->get();
|
||||||
|
|
||||||
|
$bobotMap = JurusanKriteria::where('jurusan_id', $jurusan->id)
|
||||||
|
->pluck('bobot', 'kriteria_id')
|
||||||
|
->toArray();
|
||||||
|
|
||||||
|
$aturanMap = JurusanKriteria::where('jurusan_id', $jurusan->id)
|
||||||
|
->get()
|
||||||
|
->keyBy('kriteria_id');
|
||||||
|
$penyakits = Penyakit::where('is_active', true)
|
||||||
|
->orderBy('nama_penyakit')
|
||||||
|
->get();
|
||||||
|
$penyakitTerlarangIds = $jurusan->penyakit()
|
||||||
|
->pluck('penyakit.id')
|
||||||
|
->toArray();
|
||||||
|
|
||||||
|
return view('pages.admin.jurusan.edit', compact('jurusan', 'kriterias', 'bobotMap', 'aturanMap', 'penyakits', 'penyakitTerlarangIds'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
$jurusan = Jurusan::findOrFail($id);
|
||||||
|
|
||||||
|
$kriterias = Kriteria::where('is_active', true)
|
||||||
|
->orderBy('kode_kriteria')
|
||||||
|
->get();
|
||||||
|
|
||||||
|
$rules = [
|
||||||
|
'nama_jurusan' => 'required|string|max:100|unique:jurusan,nama_jurusan,' . $id,
|
||||||
|
'is_active' => 'required|boolean',
|
||||||
|
'bobot' => 'required|array',
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($kriterias as $kriteria) {
|
||||||
|
$rules["bobot.{$kriteria->id}"] = 'required|numeric|min:0|max:1';
|
||||||
|
|
||||||
|
if ($this->isKriteriaPenyakit($kriteria)) {
|
||||||
|
$rules["wajib_lolos.{$kriteria->id}"] = 'nullable|boolean';
|
||||||
|
} elseif ($this->isKriteriaWajibLolos($kriteria)) {
|
||||||
|
$maxNilai = 100;
|
||||||
|
if ($kriteria->kode_kriteria === 'C6') $maxNilai = 1;
|
||||||
|
|
||||||
|
$rules["wajib_lolos.{$kriteria->id}"] = 'nullable|boolean';
|
||||||
|
$rules["nilai_min.{$kriteria->id}"] = "nullable|numeric|min:0|max:{$maxNilai}";
|
||||||
|
$rules["nilai_max.{$kriteria->id}"] = "nullable|numeric|min:0|max:{$maxNilai}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$rules['penyakit_larangan'] = 'nullable|array';
|
||||||
|
$rules['penyakit_larangan.*'] = 'exists:penyakit,id';
|
||||||
|
|
||||||
|
$request->validate($rules);
|
||||||
|
|
||||||
|
if ($errors = $this->validateAturanWajibLolos($request, $kriterias)) {
|
||||||
|
return back()->withErrors($errors)->withInput();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((int) $request->is_active === 1 && !$this->isBobotValid($request->bobot)) {
|
||||||
|
return back()
|
||||||
|
->withErrors([
|
||||||
|
'bobot' => 'Jurusan tidak dapat dibuat aktif karena bobot kriteria belum lengkap atau total bobot tidak sama dengan 1.00.'
|
||||||
|
])
|
||||||
|
->withInput();
|
||||||
|
}
|
||||||
|
|
||||||
|
DB::transaction(function () use ($request, $jurusan, $kriterias) {
|
||||||
|
$jurusan->update([
|
||||||
|
'nama_jurusan' => $request->nama_jurusan,
|
||||||
|
'is_active' => $request->is_active,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$updateData = [];
|
||||||
|
$existingMap = JurusanKriteria::where('jurusan_id', $jurusan->id)
|
||||||
|
->get()
|
||||||
|
->keyBy('kriteria_id');
|
||||||
|
|
||||||
|
foreach ($kriterias as $kriteria) {
|
||||||
|
$existing = $existingMap->get($kriteria->id);
|
||||||
|
$isAturanWajib = $this->isKriteriaWajibLolos($kriteria);
|
||||||
|
|
||||||
|
$updateData[] = [
|
||||||
|
'jurusan_id' => $jurusan->id,
|
||||||
|
'kriteria_id' => $kriteria->id,
|
||||||
|
'bobot' => (float) ($request->bobot[$kriteria->id] ?? 0),
|
||||||
|
'wajib_lolos' => $isAturanWajib
|
||||||
|
? $request->boolean("wajib_lolos.{$kriteria->id}")
|
||||||
|
: (bool) ($existing?->wajib_lolos ?? false),
|
||||||
|
'nilai_min' => $isAturanWajib
|
||||||
|
? $this->nilaiMinUntukKriteria($request, $kriteria)
|
||||||
|
: $existing?->nilai_min,
|
||||||
|
'nilai_max' => $isAturanWajib
|
||||||
|
? $this->nilaiMaxUntukKriteria($request, $kriteria)
|
||||||
|
: $existing?->nilai_max,
|
||||||
|
'created_at' => now(),
|
||||||
|
'updated_at' => now(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($updateData)) {
|
||||||
|
JurusanKriteria::upsert(
|
||||||
|
$updateData,
|
||||||
|
['jurusan_id', 'kriteria_id'],
|
||||||
|
['bobot', 'wajib_lolos', 'nilai_min', 'nilai_max', 'updated_at']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$jurusan->penyakit()->sync($request->input('penyakit_larangan', []));
|
||||||
|
});
|
||||||
|
|
||||||
|
ActivityLogger::log('Admin edit jurusan: ' . $jurusan->nama_jurusan);
|
||||||
|
|
||||||
|
return redirect()->route('admin.jurusan.index')
|
||||||
|
->with('success', "Jurusan {$jurusan->nama_jurusan} berhasil diperbarui!");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function toggleStatus($id)
|
||||||
|
{
|
||||||
|
$jurusan = Jurusan::findOrFail($id);
|
||||||
|
|
||||||
|
// Jika jurusan sedang nonaktif dan akan diaktifkan,
|
||||||
|
// maka bobot harus valid terlebih dahulu.
|
||||||
|
if (!$jurusan->is_active) {
|
||||||
|
$bobot = JurusanKriteria::where('jurusan_id', $jurusan->id)
|
||||||
|
->pluck('bobot')
|
||||||
|
->toArray();
|
||||||
|
|
||||||
|
if (!$this->isBobotValid($bobot)) {
|
||||||
|
return redirect()->back()
|
||||||
|
->withErrors([
|
||||||
|
'error' => 'Jurusan tidak dapat diaktifkan karena bobot kriteria belum lengkap atau total bobot tidak sama dengan 1.00.'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$jurusan->update([
|
||||||
|
'is_active' => !$jurusan->is_active
|
||||||
|
]);
|
||||||
|
|
||||||
|
$status = $jurusan->is_active ? 'diaktifkan' : 'dinonaktifkan';
|
||||||
|
|
||||||
|
ActivityLogger::log("Admin {$status} jurusan: {$jurusan->nama_jurusan}");
|
||||||
|
|
||||||
|
return redirect()->back()
|
||||||
|
->with('success', "Jurusan {$jurusan->nama_jurusan} berhasil {$status}.");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validasi bobot:
|
||||||
|
* - semua bobot harus > 0
|
||||||
|
* - total bobot harus = 1.00
|
||||||
|
*/
|
||||||
|
private function isBobotValid(array $bobot): bool
|
||||||
|
{
|
||||||
|
if (empty($bobot)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($bobot as $nilai) {
|
||||||
|
if (!is_numeric($nilai) || (float) $nilai <= 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$total = collect($bobot)->sum(fn($v) => (float) $v);
|
||||||
|
|
||||||
|
return abs($total - 1) <= 0.001;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function isKriteriaWajibLolos(Kriteria $kriteria): bool
|
||||||
|
{
|
||||||
|
return in_array($kriteria->kode_kriteria, ['C1', 'C2', 'C3', 'C4', 'C5', 'C6', 'C7', 'C8'], true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function isKriteriaPenyakit(Kriteria $kriteria): bool
|
||||||
|
{
|
||||||
|
return $kriteria->kode_kriteria === 'C8';
|
||||||
|
}
|
||||||
|
|
||||||
|
private function nullableFloat($value): ?float
|
||||||
|
{
|
||||||
|
if ($value === null || $value === '') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (float) $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function validateAturanWajibLolos(Request $request, $kriterias): array
|
||||||
|
{
|
||||||
|
$errors = [];
|
||||||
|
|
||||||
|
foreach ($kriterias as $kriteria) {
|
||||||
|
if (!$this->isKriteriaWajibLolos($kriteria)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$id = $kriteria->id;
|
||||||
|
$wajibLolos = $request->boolean("wajib_lolos.{$id}");
|
||||||
|
$nilaiMin = $this->nullableFloat($request->input("nilai_min.{$id}"));
|
||||||
|
$nilaiMax = $this->nullableFloat($request->input("nilai_max.{$id}"));
|
||||||
|
|
||||||
|
if ($this->isKriteriaPenyakit($kriteria)) {
|
||||||
|
if ($wajibLolos && empty($request->input('penyakit_larangan', []))) {
|
||||||
|
$errors['penyakit_larangan'] = 'Pilih minimal satu penyakit larangan untuk aturan wajib lolos C8.';
|
||||||
|
}
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($kriteria->kode_kriteria === 'C6') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($wajibLolos && $nilaiMin === null && $nilaiMax === null) {
|
||||||
|
$errors["nilai_min.{$id}"] = "Isi nilai minimum atau maksimum untuk aturan wajib lolos {$kriteria->kode_kriteria}.";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($nilaiMin !== null && $nilaiMax !== null && $nilaiMin > $nilaiMax) {
|
||||||
|
$errors["nilai_max.{$id}"] = "Nilai maksimum {$kriteria->kode_kriteria} harus lebih besar atau sama dengan nilai minimum.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $errors;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function nilaiMinUntukKriteria(Request $request, Kriteria $kriteria): ?float
|
||||||
|
{
|
||||||
|
if ($this->isKriteriaPenyakit($kriteria)) {
|
||||||
|
return $request->boolean("wajib_lolos.{$kriteria->id}") ? 1 : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Otomatisasi C6 (Buta Warna)
|
||||||
|
if ($kriteria->kode_kriteria === 'C6') {
|
||||||
|
return $request->boolean("wajib_lolos.{$kriteria->id}") ? 1 : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->isKriteriaWajibLolos($kriteria)) {
|
||||||
|
return $this->nullableFloat($request->input("nilai_min.{$kriteria->id}"));
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function nilaiMaxUntukKriteria(Request $request, Kriteria $kriteria): ?float
|
||||||
|
{
|
||||||
|
if ($this->isKriteriaPenyakit($kriteria)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->isKriteriaWajibLolos($kriteria)) {
|
||||||
|
return $this->nullableFloat($request->input("nilai_max.{$kriteria->id}"));
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,40 @@
|
||||||
|
<?php
|
||||||
|
namespace App\Http\Controllers\Admin;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\{Siswa, GuruBk, Jurusan, Tes, HasilSaw};
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
|
class MonitoringController extends Controller
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$totalSiswa = Siswa::count();
|
||||||
|
$totalGuruBk = GuruBk::count();
|
||||||
|
$totalJurusan = Jurusan::count();
|
||||||
|
$totalTes = Tes::count();
|
||||||
|
|
||||||
|
$peminatJurusan = HasilSaw::where('peringkat', 1)
|
||||||
|
->with('jurusan')
|
||||||
|
->select('jurusan_id', DB::raw('COUNT(*) as total'))
|
||||||
|
->groupBy('jurusan_id')->orderByDesc('total')->get();
|
||||||
|
|
||||||
|
$siswaAktif = Siswa::whereHas('user', fn($q) => $q->where('is_active', true))->count();
|
||||||
|
$siswaInaktif = Siswa::whereHas('user', fn($q) => $q->where('is_active', false))->count();
|
||||||
|
$guruBkAktif = GuruBk::whereHas('user', fn($q) => $q->where('is_active', true))->count();
|
||||||
|
$guruBkInaktif = GuruBk::whereHas('user', fn($q) => $q->where('is_active', false))->count();
|
||||||
|
|
||||||
|
$activityLogs = DB::table('activity_log')
|
||||||
|
->join('users', 'users.id', '=', 'activity_log.user_id')
|
||||||
|
->select('activity_log.*', 'users.nama as user_nama')
|
||||||
|
->orderByDesc('activity_log.created_at')
|
||||||
|
->paginate(20);
|
||||||
|
|
||||||
|
return view('pages.admin.monitoring', compact(
|
||||||
|
'totalSiswa', 'totalGuruBk', 'totalJurusan', 'totalTes',
|
||||||
|
'peminatJurusan',
|
||||||
|
'siswaAktif', 'siswaInaktif', 'guruBkAktif', 'guruBkInaktif',
|
||||||
|
'activityLogs'
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,69 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Admin;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\Penyakit;
|
||||||
|
use App\Services\ActivityLogger;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class PenyakitController extends Controller
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$penyakits = Penyakit::orderBy('nama_penyakit')->paginate(15);
|
||||||
|
|
||||||
|
return view('pages.admin.penyakit.index', compact('penyakits'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'nama_penyakit' => 'required|string|max:120|unique:penyakit,nama_penyakit',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$penyakit = Penyakit::create([
|
||||||
|
'nama_penyakit' => $request->nama_penyakit,
|
||||||
|
'is_active' => true,
|
||||||
|
]);
|
||||||
|
|
||||||
|
ActivityLogger::log('Admin tambah penyakit: ' . $penyakit->nama_penyakit);
|
||||||
|
|
||||||
|
return redirect()->route('admin.penyakit.index')
|
||||||
|
->with('success', "Penyakit {$penyakit->nama_penyakit} berhasil ditambahkan.");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
$penyakit = Penyakit::findOrFail($id);
|
||||||
|
|
||||||
|
$request->validate([
|
||||||
|
'nama_penyakit' => 'required|string|max:120|unique:penyakit,nama_penyakit,' . $penyakit->id,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$penyakit->update([
|
||||||
|
'nama_penyakit' => $request->nama_penyakit,
|
||||||
|
]);
|
||||||
|
|
||||||
|
ActivityLogger::log('Admin edit penyakit: ' . $penyakit->nama_penyakit);
|
||||||
|
|
||||||
|
return redirect()->route('admin.penyakit.index')
|
||||||
|
->with('success', "Penyakit {$penyakit->nama_penyakit} berhasil diperbarui.");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function toggleStatus($id)
|
||||||
|
{
|
||||||
|
$penyakit = Penyakit::findOrFail($id);
|
||||||
|
|
||||||
|
$penyakit->update([
|
||||||
|
'is_active' => !$penyakit->is_active,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$status = $penyakit->is_active ? 'diaktifkan' : 'dinonaktifkan';
|
||||||
|
|
||||||
|
ActivityLogger::log("Admin {$status} penyakit: {$penyakit->nama_penyakit}");
|
||||||
|
|
||||||
|
return redirect()->route('admin.penyakit.index')
|
||||||
|
->with('success', "Penyakit {$penyakit->nama_penyakit} berhasil {$status}.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,72 @@
|
||||||
|
<?php
|
||||||
|
namespace App\Http\Controllers\Admin;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\Siswa;
|
||||||
|
use App\Models\User;
|
||||||
|
use App\Services\ActivityLogger;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
|
||||||
|
class SiswaAdminController extends Controller
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$query = Siswa::with('user');
|
||||||
|
if (request('search')) {
|
||||||
|
$query->whereHas('user', fn($q) => $q->where('nama', 'like', '%'.request('search').'%')
|
||||||
|
->orWhere('email', 'like', '%'.request('search').'%'));
|
||||||
|
}
|
||||||
|
$siswas = $query->latest()->paginate(15);
|
||||||
|
return view('pages.admin.siswa.index', compact('siswas'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit($id)
|
||||||
|
{
|
||||||
|
$siswa = Siswa::with('user')->findOrFail($id);
|
||||||
|
return view('pages.admin.siswa.edit', compact('siswa'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
$siswa = Siswa::with('user')->findOrFail($id);
|
||||||
|
|
||||||
|
$request->validate([
|
||||||
|
'nama' => 'required|string|max:120',
|
||||||
|
'email' => 'required|email|unique:users,email,'.$siswa->user_id,
|
||||||
|
'no_telepon' => 'nullable|string|max:20',
|
||||||
|
'alamat' => 'nullable|string',
|
||||||
|
'sekolah_asal' => 'nullable|string|max:120',
|
||||||
|
'password' => 'nullable|string|min:8',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$siswa->user->update([
|
||||||
|
'nama' => $request->nama,
|
||||||
|
'email' => $request->email,
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($request->filled('password')) {
|
||||||
|
$siswa->user->update(['password_hash' => Hash::make($request->password)]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$siswa->update([
|
||||||
|
'no_telepon' => $request->no_telepon,
|
||||||
|
'alamat' => $request->alamat,
|
||||||
|
'sekolah_asal' => $request->sekolah_asal,
|
||||||
|
]);
|
||||||
|
|
||||||
|
ActivityLogger::log('Admin edit siswa: ' . $request->nama);
|
||||||
|
|
||||||
|
return redirect()->route('admin.siswa.index')
|
||||||
|
->with('success', "Data siswa {$request->nama} berhasil diperbarui!");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function toggleStatus($id)
|
||||||
|
{
|
||||||
|
$siswa = Siswa::with('user')->findOrFail($id);
|
||||||
|
$siswa->user->update(['is_active' => !$siswa->user->is_active]);
|
||||||
|
$status = $siswa->user->is_active ? 'diaktifkan' : 'dinonaktifkan';
|
||||||
|
ActivityLogger::log("Admin {$status} siswa: {$siswa->user->nama}");
|
||||||
|
return redirect()->back()->with('success', "Akun siswa berhasil {$status}.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
<?php
|
||||||
|
namespace App\Http\Controllers\Admin;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\{Siswa, GuruBk};
|
||||||
|
use App\Services\ActivityLogger;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class StatusController extends Controller
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$siswas = Siswa::with('user')->latest()->paginate(15, ['*'], 'siswa_page');
|
||||||
|
$guruBks = GuruBk::with(['user', 'jurusan'])->latest()->paginate(10, ['*'], 'guru_page');
|
||||||
|
return view('pages.admin.status.index', compact('siswas', 'guruBks'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function toggleSiswa($id)
|
||||||
|
{
|
||||||
|
$siswa = Siswa::with('user')->findOrFail($id);
|
||||||
|
$siswa->user->update(['is_active' => !$siswa->user->is_active]);
|
||||||
|
$status = $siswa->user->is_active ? 'diaktifkan' : 'dinonaktifkan';
|
||||||
|
ActivityLogger::log("Admin {$status} siswa: {$siswa->user->nama}");
|
||||||
|
return redirect()->back()->with('success', "Akun siswa {$siswa->user->nama} berhasil {$status}.");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function toggleGuru($id)
|
||||||
|
{
|
||||||
|
$guru = GuruBk::with('user')->findOrFail($id);
|
||||||
|
$guru->user->update(['is_active' => !$guru->user->is_active]);
|
||||||
|
$status = $guru->user->is_active ? 'diaktifkan' : 'dinonaktifkan';
|
||||||
|
ActivityLogger::log("Admin {$status} Guru BK: {$guru->user->nama}");
|
||||||
|
return redirect()->back()->with('success', "Akun Guru BK {$guru->user->nama} berhasil {$status}.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,59 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\ArtikelJurusan;
|
||||||
|
use App\Models\Jurusan;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class ArtikelPublikController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Halaman daftar semua artikel (publik, tanpa login)
|
||||||
|
* Route: GET /artikel → route('artikel.index')
|
||||||
|
*/
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
$query = ArtikelJurusan::with(['jurusan', 'creator'])
|
||||||
|
->whereHas('jurusan', fn($q) => $q->where('is_active', true));
|
||||||
|
|
||||||
|
// Filter jurusan
|
||||||
|
if ($request->filled('jurusan')) {
|
||||||
|
$query->where('jurusan_id', $request->jurusan);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Search judul / deskripsi
|
||||||
|
if ($request->filled('search')) {
|
||||||
|
$s = $request->search;
|
||||||
|
$query->where(function ($q) use ($s) {
|
||||||
|
$q->where('judul', 'like', "%$s%")
|
||||||
|
->orWhere('deskripsi', 'like', "%$s%");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
$artikels = $query->latest()->paginate(9)->withQueryString();
|
||||||
|
$jurusans = Jurusan::where('is_active', true)->orderBy('nama_jurusan')->get();
|
||||||
|
|
||||||
|
return view('pages.artikel.index', compact('artikels', 'jurusans'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Detail satu artikel
|
||||||
|
* Route: GET /artikel/{id} → route('artikel.show', $id)
|
||||||
|
*/
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
$artikel = ArtikelJurusan::with(['jurusan', 'creator', 'gambarUpload', 'fileUpload'])
|
||||||
|
->findOrFail($id);
|
||||||
|
|
||||||
|
// Artikel terkait (jurusan sama, bukan artikel ini)
|
||||||
|
$terkait = ArtikelJurusan::with(['jurusan', 'gambarUpload'])
|
||||||
|
->where('jurusan_id', $artikel->jurusan_id)
|
||||||
|
->where('id', '!=', $id)
|
||||||
|
->latest()
|
||||||
|
->take(3)
|
||||||
|
->get();
|
||||||
|
|
||||||
|
return view('pages.artikel.show', compact('artikel', 'terkait'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,72 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Http\Requests\Auth\LoginRequest;
|
||||||
|
use App\Services\OtpService;
|
||||||
|
use Illuminate\Http\RedirectResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\View\View;
|
||||||
|
|
||||||
|
class AuthenticatedSessionController extends Controller
|
||||||
|
{
|
||||||
|
public function __construct(private OtpService $otpService) {}
|
||||||
|
|
||||||
|
public function create(): View
|
||||||
|
{
|
||||||
|
return view('auth.login');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(LoginRequest $request): RedirectResponse
|
||||||
|
{
|
||||||
|
$request->authenticate();
|
||||||
|
|
||||||
|
$user = Auth::user();
|
||||||
|
|
||||||
|
// Logout sementara, login penuh hanya setelah OTP
|
||||||
|
Auth::guard('web')->logout();
|
||||||
|
|
||||||
|
if (!$user) {
|
||||||
|
return redirect()->route('login');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cek akun aktif
|
||||||
|
if (!(int) $user->is_active) {
|
||||||
|
return redirect()->route('login')
|
||||||
|
->withErrors(['email' => 'Akun tidak aktif. Hubungi admin.']);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ambil role
|
||||||
|
$roleName = strtolower(trim((string) DB::table('roles')
|
||||||
|
->where('id', $user->role_id)
|
||||||
|
->value('nama_role')));
|
||||||
|
|
||||||
|
// Semua role wajib OTP
|
||||||
|
$code = $this->otpService->generate($user);
|
||||||
|
$sent = $this->otpService->sendEmail($user, $code);
|
||||||
|
|
||||||
|
if (!$sent) {
|
||||||
|
return redirect()->route('login')
|
||||||
|
->withErrors(['email' => 'Gagal mengirim kode OTP. Periksa koneksi internet atau email Anda dan coba lagi.']);
|
||||||
|
}
|
||||||
|
|
||||||
|
session([
|
||||||
|
'otp_user_id' => $user->id,
|
||||||
|
'otp_role' => $roleName,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return redirect()->route('otp.form');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy(Request $request): RedirectResponse
|
||||||
|
{
|
||||||
|
Auth::guard('web')->logout();
|
||||||
|
$request->session()->invalidate();
|
||||||
|
$request->session()->regenerateToken();
|
||||||
|
|
||||||
|
return redirect()->route('landingpage');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,40 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\RedirectResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Validation\ValidationException;
|
||||||
|
use Illuminate\View\View;
|
||||||
|
|
||||||
|
class ConfirmablePasswordController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Show the confirm password view.
|
||||||
|
*/
|
||||||
|
public function show(): View
|
||||||
|
{
|
||||||
|
return view('auth.confirm-password');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Confirm the user's password.
|
||||||
|
*/
|
||||||
|
public function store(Request $request): RedirectResponse
|
||||||
|
{
|
||||||
|
if (! Auth::guard('web')->validate([
|
||||||
|
'email' => $request->user()->email,
|
||||||
|
'password' => $request->password,
|
||||||
|
])) {
|
||||||
|
throw ValidationException::withMessages([
|
||||||
|
'password' => __('auth.password'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$request->session()->put('auth.password_confirmed_at', time());
|
||||||
|
|
||||||
|
return redirect()->intended(route('dashboard', absolute: false));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\RedirectResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class EmailVerificationNotificationController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Send a new email verification notification.
|
||||||
|
*/
|
||||||
|
public function store(Request $request): RedirectResponse
|
||||||
|
{
|
||||||
|
if ($request->user()->hasVerifiedEmail()) {
|
||||||
|
return redirect()->intended(route('dashboard', absolute: false));
|
||||||
|
}
|
||||||
|
|
||||||
|
$request->user()->sendEmailVerificationNotification();
|
||||||
|
|
||||||
|
return back()->with('status', 'verification-link-sent');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\RedirectResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\View\View;
|
||||||
|
|
||||||
|
class EmailVerificationPromptController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display the email verification prompt.
|
||||||
|
*/
|
||||||
|
public function __invoke(Request $request): RedirectResponse|View
|
||||||
|
{
|
||||||
|
return $request->user()->hasVerifiedEmail()
|
||||||
|
? redirect()->intended(route('dashboard', absolute: false))
|
||||||
|
: view('auth.verify-email');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,65 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Requests\Auth;
|
||||||
|
|
||||||
|
use Illuminate\Auth\Events\Lockout;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\RateLimiter;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
use Illuminate\Validation\ValidationException;
|
||||||
|
|
||||||
|
class LoginRequest extends FormRequest
|
||||||
|
{
|
||||||
|
public function authorize(): bool
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function rules(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'email' => ['required', 'string', 'email'],
|
||||||
|
'password' => ['required', 'string'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function authenticate(): void
|
||||||
|
{
|
||||||
|
$this->ensureIsNotRateLimited();
|
||||||
|
|
||||||
|
// IMPORTANT: guard web (Breeze default)
|
||||||
|
if (! Auth::guard('web')->attempt($this->only('email', 'password'), $this->boolean('remember'))) {
|
||||||
|
RateLimiter::hit($this->throttleKey());
|
||||||
|
|
||||||
|
throw ValidationException::withMessages([
|
||||||
|
'email' => trans('auth.failed'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
RateLimiter::clear($this->throttleKey());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function ensureIsNotRateLimited(): void
|
||||||
|
{
|
||||||
|
if (! RateLimiter::tooManyAttempts($this->throttleKey(), 5)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
event(new Lockout($this));
|
||||||
|
|
||||||
|
$seconds = RateLimiter::availableIn($this->throttleKey());
|
||||||
|
|
||||||
|
throw ValidationException::withMessages([
|
||||||
|
'email' => trans('auth.throttle', [
|
||||||
|
'seconds' => $seconds,
|
||||||
|
'minutes' => ceil($seconds / 60),
|
||||||
|
]),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function throttleKey(): string
|
||||||
|
{
|
||||||
|
return Str::transliterate(Str::lower($this->string('email')).'|'.$this->ip());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,73 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Auth\Events\PasswordReset;
|
||||||
|
use Illuminate\Http\RedirectResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
use Illuminate\Support\Facades\Password;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
use Illuminate\Validation\Rules;
|
||||||
|
use Illuminate\View\View;
|
||||||
|
|
||||||
|
class NewPasswordController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display the password reset view.
|
||||||
|
*/
|
||||||
|
public function create(Request $request): View
|
||||||
|
{
|
||||||
|
return view('auth.reset-password', ['request' => $request]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle an incoming new password request.
|
||||||
|
*
|
||||||
|
* @throws \Illuminate\Validation\ValidationException
|
||||||
|
*/
|
||||||
|
public function store(Request $request): RedirectResponse
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'token' => ['required'],
|
||||||
|
'email' => ['required', 'email'],
|
||||||
|
'password' => ['required', 'confirmed', Rules\Password::defaults()],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$user = User::with('role')
|
||||||
|
->where('email', $request->email)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if ($user && $user->isGuruBk() && $user->must_change_password) {
|
||||||
|
return back()
|
||||||
|
->withInput($request->only('email'))
|
||||||
|
->withErrors([
|
||||||
|
'email' => 'Password akun Guru BK ini belum pernah diganti. Silakan login menggunakan password awal lalu ubah password dari menu Guru BK.',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Here we will attempt to reset the user's password. If it is successful we
|
||||||
|
// will update the password on an actual user model and persist it to the
|
||||||
|
// database. Otherwise we will parse the error and return the response.
|
||||||
|
$status = Password::reset(
|
||||||
|
$request->only('email', 'password', 'password_confirmation', 'token'),
|
||||||
|
function (User $user) use ($request) {
|
||||||
|
$user->forceFill([
|
||||||
|
'password_hash' => Hash::make($request->password),
|
||||||
|
])->save();
|
||||||
|
|
||||||
|
event(new PasswordReset($user));
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// If the password was successfully reset, we will redirect the user back to
|
||||||
|
// the application's home authenticated view. If there is an error we can
|
||||||
|
// redirect them back to where they came from with their error message.
|
||||||
|
return $status == Password::PASSWORD_RESET
|
||||||
|
? redirect()->route('login')->with('status', __($status))
|
||||||
|
: back()->withInput($request->only('email'))
|
||||||
|
->withErrors(['email' => __($status)]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,74 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\User;
|
||||||
|
use App\Services\OtpService;
|
||||||
|
use Illuminate\Http\RedirectResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\View\View;
|
||||||
|
use App\Models\ActivityLog;
|
||||||
|
class OtpController extends Controller
|
||||||
|
{
|
||||||
|
public function __construct(private OtpService $otpService) {}
|
||||||
|
|
||||||
|
public function showForm(): View
|
||||||
|
{
|
||||||
|
abort_unless(session()->has('otp_user_id'), 403);
|
||||||
|
return view('auth.otp');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function verify(Request $request): RedirectResponse
|
||||||
|
{
|
||||||
|
$request->validate(['code' => 'required|digits:6']);
|
||||||
|
|
||||||
|
$userId = session('otp_user_id');
|
||||||
|
$roleName = session('otp_role');
|
||||||
|
|
||||||
|
if (!$userId) {
|
||||||
|
return redirect()->route('login')
|
||||||
|
->withErrors(['email' => 'Sesi habis, silakan login ulang.']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$user = User::findOrFail($userId);
|
||||||
|
$valid = $this->otpService->verify($user, $request->code);
|
||||||
|
|
||||||
|
if (!$valid) {
|
||||||
|
return back()->withErrors(['code' => 'Kode OTP salah atau sudah kadaluarsa.']);
|
||||||
|
}
|
||||||
|
|
||||||
|
Auth::login($user);
|
||||||
|
$request->session()->regenerate();
|
||||||
|
session()->forget(['otp_user_id', 'otp_role']);
|
||||||
|
|
||||||
|
ActivityLog::create([
|
||||||
|
'user_id' => $user->id,
|
||||||
|
'aksi' => 'Login sebagai ' . $roleName,
|
||||||
|
]);
|
||||||
|
if ($roleName === 'admin') return redirect()->route('admin.dashboard');
|
||||||
|
if ($roleName === 'guru_bk') return redirect()->route('bk.dashboard');
|
||||||
|
|
||||||
|
return redirect()->route('landingpage');
|
||||||
|
}
|
||||||
|
public function resend(Request $request): RedirectResponse
|
||||||
|
{
|
||||||
|
$userId = session('otp_user_id');
|
||||||
|
|
||||||
|
if (!$userId) {
|
||||||
|
return redirect()->route('login')
|
||||||
|
->withErrors(['email' => 'Sesi habis, silakan login ulang.']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$user = User::findOrFail($userId);
|
||||||
|
$code = $this->otpService->generate($user);
|
||||||
|
$sent = $this->otpService->sendEmail($user, $code);
|
||||||
|
|
||||||
|
if (!$sent) {
|
||||||
|
return back()->withErrors(['code' => 'Gagal mengirim ulang OTP. Periksa koneksi internet Anda.']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return back()->with('success', 'Kode OTP baru telah dikirim ke email Anda.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\RedirectResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
use Illuminate\Validation\Rules\Password;
|
||||||
|
|
||||||
|
class PasswordController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Update the user's password.
|
||||||
|
*/
|
||||||
|
public function update(Request $request): RedirectResponse
|
||||||
|
{
|
||||||
|
$validated = $request->validateWithBag('updatePassword', [
|
||||||
|
'current_password' => ['required', 'current_password'],
|
||||||
|
'password' => ['required', Password::defaults(), 'confirmed'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$request->user()->update([
|
||||||
|
'password' => Hash::make($validated['password']),
|
||||||
|
]);
|
||||||
|
|
||||||
|
return back()->with('status', 'password-updated');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,57 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Http\RedirectResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Password;
|
||||||
|
use Illuminate\View\View;
|
||||||
|
|
||||||
|
class PasswordResetLinkController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display the password reset link request view.
|
||||||
|
*/
|
||||||
|
public function create(): View
|
||||||
|
{
|
||||||
|
return view('auth.forgot-password');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle an incoming password reset link request.
|
||||||
|
*
|
||||||
|
* @throws \Illuminate\Validation\ValidationException
|
||||||
|
*/
|
||||||
|
public function store(Request $request): RedirectResponse
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'email' => ['required', 'email'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$user = User::with('role')
|
||||||
|
->where('email', $request->email)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if ($user && $user->isGuruBk() && $user->must_change_password) {
|
||||||
|
return back()
|
||||||
|
->withInput($request->only('email'))
|
||||||
|
->withErrors([
|
||||||
|
'email' => 'Guru BK yang baru dibuat admin harus login dan mengganti password terlebih dahulu sebelum dapat menggunakan fitur lupa password.',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// We will send the password reset link to this user. Once we have attempted
|
||||||
|
// to send the link, we will examine the response then see the message we
|
||||||
|
// need to show to the user. Finally, we'll send out a proper response.
|
||||||
|
$status = Password::sendResetLink(
|
||||||
|
$request->only('email')
|
||||||
|
);
|
||||||
|
|
||||||
|
return $status == Password::RESET_LINK_SENT
|
||||||
|
? back()->with('status', __($status))
|
||||||
|
: back()->withInput($request->only('email'))
|
||||||
|
->withErrors(['email' => __($status)]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,75 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Auth\Events\Registered;
|
||||||
|
use Illuminate\Http\RedirectResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
use Illuminate\Validation\Rules;
|
||||||
|
use Illuminate\View\View;
|
||||||
|
use App\Models\Role;
|
||||||
|
use App\Models\Siswa;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Validation\Rules\Password;
|
||||||
|
|
||||||
|
class RegisteredUserController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display the registration view.
|
||||||
|
*/
|
||||||
|
public function create(): View
|
||||||
|
{
|
||||||
|
return view('auth.register');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle an incoming registration request.
|
||||||
|
*
|
||||||
|
* @throws \Illuminate\Validation\ValidationException
|
||||||
|
*/
|
||||||
|
public function store(Request $request): RedirectResponse
|
||||||
|
{
|
||||||
|
$validated = $request->validate([
|
||||||
|
'nama' => 'required|string|max:120',
|
||||||
|
'email' => 'required|string|lowercase|email|max:191|unique:users,email',
|
||||||
|
'password' => ['required', 'confirmed', Password::min(8)->letters()->numbers()],
|
||||||
|
'sekolah_asal' => 'required|string|max:150',
|
||||||
|
'jenis_kelamin' => 'required|in:L,P',
|
||||||
|
'no_telepon' => 'required|string|max:30',
|
||||||
|
'alamat' => 'required|string',
|
||||||
|
]);
|
||||||
|
|
||||||
|
// role siswa harus ada (sesuai ketentuan)
|
||||||
|
$roleSiswa = Role::where('nama_role', 'siswa')->firstOrFail();
|
||||||
|
$roleId = $roleSiswa->role_id ?? $roleSiswa->id; // aman untuk variasi PK roles
|
||||||
|
|
||||||
|
DB::transaction(function () use ($validated, $roleId) {
|
||||||
|
$user = User::create([
|
||||||
|
'role_id' => $roleId,
|
||||||
|
'nama' => $validated['nama'],
|
||||||
|
'email' => $validated['email'],
|
||||||
|
'password_hash' => Hash::make($validated['password']),
|
||||||
|
'is_active' => true,
|
||||||
|
'must_change_password' => false,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$userPk = $user->user_id ?? $user->id; // aman untuk variasi PK users
|
||||||
|
|
||||||
|
Siswa::create([
|
||||||
|
'user_id' => $userPk,
|
||||||
|
'sekolah_asal' => $validated['sekolah_asal'],
|
||||||
|
'jenis_kelamin' => $validated['jenis_kelamin'],
|
||||||
|
'no_telepon' => $validated['no_telepon'],
|
||||||
|
'alamat' => $validated['alamat'],
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Breeze biasanya auto-login setelah register,
|
||||||
|
// tapi kebutuhan Anda: boleh auto-login atau redirect login.
|
||||||
|
return redirect()->route('login')->with('success', 'Registrasi berhasil, silakan login.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Auth\Events\Verified;
|
||||||
|
use Illuminate\Foundation\Auth\EmailVerificationRequest;
|
||||||
|
use Illuminate\Http\RedirectResponse;
|
||||||
|
|
||||||
|
class VerifyEmailController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Mark the authenticated user's email address as verified.
|
||||||
|
*/
|
||||||
|
public function __invoke(EmailVerificationRequest $request): RedirectResponse
|
||||||
|
{
|
||||||
|
if ($request->user()->hasVerifiedEmail()) {
|
||||||
|
return redirect()->intended(route('dashboard', absolute: false).'?verified=1');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($request->user()->markEmailAsVerified()) {
|
||||||
|
event(new Verified($request->user()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return redirect()->intended(route('dashboard', absolute: false).'?verified=1');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,217 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Bk;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\ArtikelJurusan;
|
||||||
|
use App\Models\Jurusan;
|
||||||
|
use App\Models\Upload;
|
||||||
|
use App\Services\ActivityLogger;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
|
||||||
|
class ArtikelController extends Controller
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$guruBk = \App\Models\GuruBk::where('user_id', Auth::id())->first();
|
||||||
|
|
||||||
|
$artikels = ArtikelJurusan::with(['jurusan', 'gambarUpload', 'fileUpload'])
|
||||||
|
->where('created_by_user_id', Auth::id())
|
||||||
|
->latest()
|
||||||
|
->paginate(12);
|
||||||
|
|
||||||
|
return view('pages.bk.artikel.index', compact('artikels'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
$guruBk = \App\Models\GuruBk::where('user_id', Auth::id())->first();
|
||||||
|
|
||||||
|
$jurusans = $guruBk && $guruBk->jurusan_id
|
||||||
|
? \App\Models\Jurusan::where('id', $guruBk->jurusan_id)->get()
|
||||||
|
: collect();
|
||||||
|
|
||||||
|
return view('pages.bk.artikel.create', compact('jurusans'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$guruBk = \App\Models\GuruBk::where('user_id', Auth::id())->first();
|
||||||
|
|
||||||
|
$request->validate([
|
||||||
|
'jurusan_id' => [
|
||||||
|
'required',
|
||||||
|
'exists:jurusan,id',
|
||||||
|
function ($attr, $value, $fail) use ($guruBk) {
|
||||||
|
if ($guruBk && $guruBk->jurusan_id && $value != $guruBk->jurusan_id) {
|
||||||
|
$fail('Anda hanya bisa membuat artikel untuk jurusan Anda sendiri.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'judul' => 'required|string|max:200',
|
||||||
|
'deskripsi' => 'required|string',
|
||||||
|
'gambar' => 'nullable|image|mimes:jpg,jpeg|max:8192',
|
||||||
|
'file' => 'nullable|mimes:pdf,mp4|max:51200',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$artikel = ArtikelJurusan::create([
|
||||||
|
'jurusan_id' => $guruBk->jurusan_id,
|
||||||
|
'judul' => $request->judul,
|
||||||
|
'deskripsi' => $request->deskripsi,
|
||||||
|
'gambar_upload_id' => $this->simpanUpload($request, 'gambar', 'artikel/gambar'),
|
||||||
|
'file_upload_id' => $this->simpanUpload($request, 'file', 'artikel/file'),
|
||||||
|
'created_by_user_id' => Auth::id(),
|
||||||
|
]);
|
||||||
|
|
||||||
|
ActivityLogger::log('Guru BK tambah artikel: ' . $artikel->judul);
|
||||||
|
|
||||||
|
return redirect()->route('bk.artikel.index')->with('success', 'Artikel berhasil ditambahkan!');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit($id)
|
||||||
|
{
|
||||||
|
$artikel = ArtikelJurusan::with(['jurusan', 'gambarUpload', 'fileUpload'])->findOrFail($id);
|
||||||
|
|
||||||
|
$guruBk = \App\Models\GuruBk::where('user_id', Auth::id())->first();
|
||||||
|
|
||||||
|
$jurusans = $guruBk && $guruBk->jurusan_id
|
||||||
|
? Jurusan::where('id', $guruBk->jurusan_id)->get()
|
||||||
|
: collect();
|
||||||
|
|
||||||
|
return view('pages.bk.artikel.edit', compact('artikel', 'jurusans'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
$artikel = ArtikelJurusan::findOrFail($id);
|
||||||
|
|
||||||
|
$guruBk = \App\Models\GuruBk::where('user_id', Auth::id())->first();
|
||||||
|
|
||||||
|
$request->validate([
|
||||||
|
'jurusan_id' => [
|
||||||
|
'required',
|
||||||
|
'exists:jurusan,id',
|
||||||
|
function ($attr, $value, $fail) use ($guruBk) {
|
||||||
|
if ($guruBk && $guruBk->jurusan_id && $value != $guruBk->jurusan_id) {
|
||||||
|
$fail('Anda hanya bisa mengubah artikel untuk jurusan Anda sendiri.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'judul' => 'required|string|max:200',
|
||||||
|
'deskripsi' => 'required|string',
|
||||||
|
'gambar' => 'nullable|image|mimes:jpg,jpeg|max:8192',
|
||||||
|
'file' => 'nullable|mimes:pdf,mp4|max:51200',
|
||||||
|
]);
|
||||||
|
|
||||||
|
DB::transaction(function () use ($request, $artikel) {
|
||||||
|
$oldGambarId = $artikel->gambar_upload_id;
|
||||||
|
$oldFileId = $artikel->file_upload_id;
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'jurusan_id' => $request->jurusan_id,
|
||||||
|
'judul' => $request->judul,
|
||||||
|
'deskripsi' => $request->deskripsi,
|
||||||
|
];
|
||||||
|
|
||||||
|
if ($request->hasFile('gambar')) {
|
||||||
|
$data['gambar_upload_id'] = $this->simpanUpload($request, 'gambar', 'artikel/gambar');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($request->hasFile('file')) {
|
||||||
|
$data['file_upload_id'] = $this->simpanUpload($request, 'file', 'artikel/file');
|
||||||
|
}
|
||||||
|
|
||||||
|
$artikel->update($data);
|
||||||
|
|
||||||
|
if ($request->hasFile('gambar') && $oldGambarId) {
|
||||||
|
$this->hapusUpload($oldGambarId);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($request->hasFile('file') && $oldFileId) {
|
||||||
|
$this->hapusUpload($oldFileId);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
ActivityLogger::log('Guru BK edit artikel: ' . $artikel->judul);
|
||||||
|
|
||||||
|
return redirect()->route('bk.artikel.index')->with('success', 'Artikel berhasil diperbarui!');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
$artikel = ArtikelJurusan::findOrFail($id);
|
||||||
|
$judul = $artikel->judul;
|
||||||
|
|
||||||
|
DB::transaction(function () use ($artikel) {
|
||||||
|
$gambarId = $artikel->gambar_upload_id;
|
||||||
|
$fileId = $artikel->file_upload_id;
|
||||||
|
|
||||||
|
$artikel->delete();
|
||||||
|
|
||||||
|
if ($gambarId) {
|
||||||
|
$this->hapusUpload($gambarId);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($fileId) {
|
||||||
|
$this->hapusUpload($fileId);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
ActivityLogger::log('Guru BK hapus artikel: ' . $judul);
|
||||||
|
|
||||||
|
return redirect()->route('bk.artikel.index')->with('success', 'Artikel berhasil dihapus.');
|
||||||
|
}
|
||||||
|
|
||||||
|
private function simpanUpload(Request $request, string $input, string $folder): ?int
|
||||||
|
{
|
||||||
|
if (!$request->hasFile($input)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$file = $request->file($input);
|
||||||
|
$mime = $file->getMimeType();
|
||||||
|
|
||||||
|
if (str_contains($mime, 'pdf')) {
|
||||||
|
$ext = 'PDF';
|
||||||
|
} elseif (str_contains($mime, 'mp4')) {
|
||||||
|
$ext = 'MP4';
|
||||||
|
} elseif (str_contains($mime, 'jpeg') || str_contains($mime, 'jpg')) {
|
||||||
|
$ext = 'JPG';
|
||||||
|
} else {
|
||||||
|
$ext = strtoupper($file->getClientOriginalExtension() ?: 'FILE');
|
||||||
|
}
|
||||||
|
|
||||||
|
$upload = Upload::create([
|
||||||
|
'uploader_user_id' => auth()->id(),
|
||||||
|
'file_name' => $file->getClientOriginalName(),
|
||||||
|
'ext' => $ext,
|
||||||
|
'mime_type' => $mime,
|
||||||
|
'size_mb' => round($file->getSize() / 1048576, 2),
|
||||||
|
'storage_path' => $file->store($folder, 'public'),
|
||||||
|
]);
|
||||||
|
|
||||||
|
return $upload->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function hapusUpload(?int $uploadId): void
|
||||||
|
{
|
||||||
|
if (!$uploadId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$u = Upload::find($uploadId);
|
||||||
|
|
||||||
|
if (!$u) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($u->storage_path && Storage::disk('public')->exists($u->storage_path)) {
|
||||||
|
Storage::disk('public')->delete($u->storage_path);
|
||||||
|
}
|
||||||
|
|
||||||
|
$u->delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,38 @@
|
||||||
|
<?php
|
||||||
|
namespace App\Http\Controllers\Bk;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\{Siswa, Tes, HasilSaw};
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
|
class DashboardController extends Controller
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$totalSiswa = Siswa::count();
|
||||||
|
$sudahTes = Tes::distinct('siswa_id')->count('siswa_id');
|
||||||
|
$belumTes = $totalSiswa - $sudahTes;
|
||||||
|
|
||||||
|
$minatBeda = Tes::whereHas('rekomendasiTeratas', function ($q) {
|
||||||
|
$q->whereColumn('hasil_saw.jurusan_id', '!=', 'tes.minat_jurusan_1_id');
|
||||||
|
})->distinct('siswa_id')->count('siswa_id');
|
||||||
|
|
||||||
|
$trenTes = Tes::selectRaw('MONTH(created_at) as bulan, YEAR(created_at) as tahun, COUNT(*) as total')
|
||||||
|
->where('created_at', '>=', now()->subMonths(1))
|
||||||
|
->groupByRaw('YEAR(created_at), MONTH(created_at)')
|
||||||
|
->orderBy('tahun')->orderBy('bulan')->get();
|
||||||
|
|
||||||
|
$rekapJurusan = HasilSaw::where('peringkat', 1)
|
||||||
|
->with('jurusan')
|
||||||
|
->select('jurusan_id', DB::raw('COUNT(*) as total'))
|
||||||
|
->groupBy('jurusan_id')->orderByDesc('total')->get();
|
||||||
|
|
||||||
|
$tesTerbaru = Tes::with(['siswa.user', 'minatJurusan1', 'rekomendasiTeratas.jurusan'])
|
||||||
|
->latest()->take(5)->get();
|
||||||
|
|
||||||
|
return view('pages.bk.dashboard', compact(
|
||||||
|
'totalSiswa', 'sudahTes', 'belumTes', 'minatBeda',
|
||||||
|
'trenTes', 'rekapJurusan', 'tesTerbaru'
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,111 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Bk;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\{InformasiJurusan, ProspekKerja, Jurusan};
|
||||||
|
use App\Services\ActivityLogger;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
|
class InfoJurusanController extends Controller
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$guruBk = \App\Models\GuruBk::where('user_id', Auth::id())->first();
|
||||||
|
|
||||||
|
if ($guruBk && $guruBk->jurusan_id) {
|
||||||
|
return redirect()->route('bk.infojurusan.show', $guruBk->jurusan_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
return redirect()->route('bk.dashboard')
|
||||||
|
->with('warning', 'Anda belum ditugaskan ke jurusan manapun.');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
$guruBk = \App\Models\GuruBk::where('user_id', Auth::id())->first();
|
||||||
|
|
||||||
|
if ($guruBk && $guruBk->jurusan_id && $guruBk->jurusan_id != $id) {
|
||||||
|
return redirect()->route('bk.dashboard')
|
||||||
|
->with('warning', 'Akses ditolak.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$jurusan = Jurusan::with(['informasiJurusan', 'prospekKerja'])->findOrFail($id);
|
||||||
|
$info = $jurusan->informasiJurusan;
|
||||||
|
$prospekUmum = $jurusan->prospekKerja->where('tipe', 'umum');
|
||||||
|
$prospekAlumni = $jurusan->prospekKerja->where('tipe', 'alumni');
|
||||||
|
|
||||||
|
return view('pages.bk.infojurusan.show', compact(
|
||||||
|
'jurusan', 'info', 'prospekUmum', 'prospekAlumni'
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit($id)
|
||||||
|
{
|
||||||
|
$guruBk = \App\Models\GuruBk::where('user_id', Auth::id())->first();
|
||||||
|
|
||||||
|
// Pastikan BK hanya bisa edit jurusannya sendiri
|
||||||
|
if ($guruBk && $guruBk->jurusan_id && $guruBk->jurusan_id != $id) {
|
||||||
|
return redirect()->route('bk.infojurusan.index')
|
||||||
|
->with('warning', 'Anda hanya bisa mengelola jurusan Anda sendiri.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$jurusan = Jurusan::with(['informasiJurusan', 'prospekKerja'])->findOrFail($id);
|
||||||
|
$info = $jurusan->informasiJurusan;
|
||||||
|
$prospekUmum = $jurusan->prospekKerja->where('tipe', 'umum')->pluck('isi');
|
||||||
|
$prospekAlumni = $jurusan->prospekKerja->where('tipe', 'alumni')->pluck('isi');
|
||||||
|
|
||||||
|
return view('pages.bk.infojurusan.edit', compact(
|
||||||
|
'jurusan', 'info', 'prospekUmum', 'prospekAlumni'
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(Request $request, $jurusanId)
|
||||||
|
{
|
||||||
|
$guruBk = \App\Models\GuruBk::where('user_id', Auth::id())->first();
|
||||||
|
if ($guruBk && $guruBk->jurusan_id && $guruBk->jurusan_id != $jurusanId) {
|
||||||
|
return redirect()->route('bk.infojurusan.index')
|
||||||
|
->with('warning', 'Anda hanya bisa mengelola jurusan Anda sendiri.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$jurusan = Jurusan::findOrFail($jurusanId);
|
||||||
|
|
||||||
|
InformasiJurusan::updateOrCreate(
|
||||||
|
['jurusan_id' => $jurusanId],
|
||||||
|
[
|
||||||
|
'fasilitas' => $request->fasilitas ?? '',
|
||||||
|
'updated_by_user_id' => Auth::id()
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
ProspekKerja::where('jurusan_id', $jurusanId)
|
||||||
|
->where('tipe', 'umum')
|
||||||
|
->delete();
|
||||||
|
|
||||||
|
foreach (array_filter($request->prospek_umum ?? []) as $isi) {
|
||||||
|
ProspekKerja::create([
|
||||||
|
'jurusan_id' => $jurusanId,
|
||||||
|
'tipe' => 'umum',
|
||||||
|
'isi' => $isi
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
ProspekKerja::where('jurusan_id', $jurusanId)
|
||||||
|
->where('tipe', 'alumni')
|
||||||
|
->delete();
|
||||||
|
|
||||||
|
foreach (array_filter($request->prospek_alumni ?? []) as $isi) {
|
||||||
|
ProspekKerja::create([
|
||||||
|
'jurusan_id' => $jurusanId,
|
||||||
|
'tipe' => 'alumni',
|
||||||
|
'isi' => $isi
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
ActivityLogger::log('Guru BK edit info jurusan: ' . $jurusan->nama_jurusan);
|
||||||
|
|
||||||
|
return redirect()->route('bk.infojurusan.show', $jurusanId)
|
||||||
|
->with('success', "Informasi jurusan berhasil diperbarui!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,63 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Bk;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Services\ActivityLogger;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
|
||||||
|
class PasswordController extends Controller
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
return view('pages.bk.password');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(Request $request)
|
||||||
|
{
|
||||||
|
$user = Auth::user();
|
||||||
|
|
||||||
|
if (!$user) {
|
||||||
|
return redirect()->route('login')->with('error', 'Silakan login terlebih dahulu.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$user->loadMissing(['role', 'guruBk']);
|
||||||
|
|
||||||
|
$request->validate([
|
||||||
|
'current_password' => [
|
||||||
|
'required',
|
||||||
|
function ($attr, $value, $fail) use ($user) {
|
||||||
|
if (!Hash::check($value, $user->password_hash)) {
|
||||||
|
$fail('Password lama tidak sesuai.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'password' => 'required|string|min:8|confirmed',
|
||||||
|
], [
|
||||||
|
'current_password.required' => 'Password lama wajib diisi.',
|
||||||
|
'password.required' => 'Password baru wajib diisi.',
|
||||||
|
'password.min' => 'Password baru minimal 8 karakter.',
|
||||||
|
'password.confirmed' => 'Konfirmasi password tidak cocok.',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$user->update([
|
||||||
|
'password_hash' => Hash::make($request->password),
|
||||||
|
'must_change_password' => false,
|
||||||
|
]);
|
||||||
|
|
||||||
|
ActivityLogger::log('Guru BK ubah password');
|
||||||
|
|
||||||
|
// Cek lagi apakah profil Guru BK masih belum lengkap
|
||||||
|
if ($user->isGuruBkProfileIncomplete()) {
|
||||||
|
return redirect()
|
||||||
|
->route('bk.profil')
|
||||||
|
->with('success', 'Password berhasil diubah. Silakan lengkapi profil Guru BK.');
|
||||||
|
}
|
||||||
|
|
||||||
|
return redirect()
|
||||||
|
->route('bk.dashboard')
|
||||||
|
->with('success', 'Password berhasil diubah!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,65 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Bk;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Services\ActivityLogger;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
|
class ProfilController extends Controller
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$user = Auth::user();
|
||||||
|
|
||||||
|
if (!$user) {
|
||||||
|
return redirect()->route('login')->with('error', 'Silakan login terlebih dahulu.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$user->loadMissing(['guruBk.jurusan']);
|
||||||
|
|
||||||
|
$guruBk = $user->guruBk;
|
||||||
|
|
||||||
|
return view('pages.bk.profil', compact('user', 'guruBk'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(Request $request)
|
||||||
|
{
|
||||||
|
$user = Auth::user();
|
||||||
|
|
||||||
|
if (!$user) {
|
||||||
|
return redirect()->route('login')->with('error', 'Silakan login terlebih dahulu.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$request->validate([
|
||||||
|
'nama' => 'required|string|max:120',
|
||||||
|
'email' => 'required|email|unique:users,email,' . $user->id,
|
||||||
|
], [
|
||||||
|
'nama.required' => 'Nama wajib diisi.',
|
||||||
|
'email.required' => 'Email wajib diisi.',
|
||||||
|
'email.email' => 'Format email tidak valid.',
|
||||||
|
'email.unique' => 'Email sudah digunakan.',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$user->update([
|
||||||
|
'nama' => $request->nama,
|
||||||
|
'email' => $request->email,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$user->refresh();
|
||||||
|
$user->loadMissing(['role', 'guruBk']);
|
||||||
|
|
||||||
|
ActivityLogger::log('Guru BK edit profil: ' . $user->nama);
|
||||||
|
|
||||||
|
if ($user->must_change_password) {
|
||||||
|
return redirect()
|
||||||
|
->route('bk.password.index')
|
||||||
|
->with('success', 'Profil berhasil diperbarui. Silakan ganti password terlebih dahulu.');
|
||||||
|
}
|
||||||
|
|
||||||
|
return redirect()
|
||||||
|
->route('bk.profil')
|
||||||
|
->with('success', 'Profil berhasil diperbarui.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,79 @@
|
||||||
|
<?php
|
||||||
|
namespace App\Http\Controllers\Bk;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\{Siswa, Tes};
|
||||||
|
use App\Services\TesPdfService;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
|
||||||
|
class SiswaController extends Controller
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$query = Siswa::with([
|
||||||
|
'user',
|
||||||
|
'tes' => fn($q) => $q->latest()->with('rekomendasiTeratas.jurusan', 'minatJurusan1', 'minatJurusan2'),
|
||||||
|
]);
|
||||||
|
|
||||||
|
if (request('search')) {
|
||||||
|
$query->whereHas('user', fn($q) => $q->where('nama', 'like', '%'.request('search').'%'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$siswas = $query->paginate(15);
|
||||||
|
return view('pages.bk.siswa.index', compact('siswas'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
$siswa = Siswa::with('user')->findOrFail($id);
|
||||||
|
|
||||||
|
$riwayatTes = Tes::where('siswa_id', $id)
|
||||||
|
->with([
|
||||||
|
'rekomendasiTeratas.jurusan',
|
||||||
|
'minatJurusan1', 'minatJurusan2',
|
||||||
|
'hasilSaw' => fn($q) => $q->orderBy('peringkat')->with('jurusan'),
|
||||||
|
])->latest()->get();
|
||||||
|
|
||||||
|
return view('pages.bk.siswa.show', compact('siswa', 'riwayatTes'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function downloadPdf($siswaId, $tesId, TesPdfService $tesPdfService)
|
||||||
|
{
|
||||||
|
$tes = \App\Models\Tes::where('siswa_id', $siswaId)->findOrFail($tesId);
|
||||||
|
|
||||||
|
$tesPdf = $tesPdfService->ensureAvailable($tes);
|
||||||
|
|
||||||
|
if (!$tesPdf?->upload || !$tesPdf->upload->existsOnPublicDisk()) {
|
||||||
|
return back()->with('warning', 'File PDF belum tersedia untuk tes ini.');
|
||||||
|
}
|
||||||
|
|
||||||
|
return Storage::disk('public')->download(
|
||||||
|
$tesPdf->upload->normalizedStoragePath(),
|
||||||
|
'hasil_tes_' . $tesId . '.pdf'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function hasilTes($siswaId, $tesId)
|
||||||
|
{
|
||||||
|
$tes = \App\Models\Tes::with([
|
||||||
|
'siswa.user',
|
||||||
|
'hasilSaw' => fn($q) => $q->orderBy('peringkat')->with('jurusan'),
|
||||||
|
'minatJurusan1', 'minatJurusan2',
|
||||||
|
])->where('siswa_id', $siswaId)->findOrFail($tesId);
|
||||||
|
|
||||||
|
$hasilList = $tes->hasilSaw;
|
||||||
|
$tesTerakhir = $tes;
|
||||||
|
$siswa = $tes->siswa;
|
||||||
|
|
||||||
|
$jurusanPilihan1 = $tes->minatJurusan1;
|
||||||
|
$jurusanPilihan2 = $tes->minatJurusan2;
|
||||||
|
$skorPilihan1 = $hasilList->firstWhere('jurusan_id', $tes->minat_jurusan_1_id);
|
||||||
|
$skorPilihan2 = $hasilList->firstWhere('jurusan_id', $tes->minat_jurusan_2_id);
|
||||||
|
|
||||||
|
return view('pages.siswa.hasil', compact(
|
||||||
|
'hasilList', 'tesTerakhir', 'siswa',
|
||||||
|
'jurusanPilihan1', 'jurusanPilihan2',
|
||||||
|
'skorPilihan1', 'skorPilihan2'
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
<?php
|
||||||
|
namespace App\Http\Controllers\Bk;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\{Tes, HasilSaw};
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
|
class StatistikController extends Controller
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$peminatJurusan = HasilSaw::where('peringkat', 1)
|
||||||
|
->with('jurusan')
|
||||||
|
->select('jurusan_id', DB::raw('COUNT(*) as total'))
|
||||||
|
->groupBy('jurusan_id')->orderByDesc('total')->get();
|
||||||
|
|
||||||
|
$kesesuaian = DB::table('tes')
|
||||||
|
->join('hasil_saw', function ($j) {
|
||||||
|
$j->on('hasil_saw.tes_id', '=', 'tes.id')
|
||||||
|
->where('hasil_saw.peringkat', 1);
|
||||||
|
})
|
||||||
|
->join('jurusan', 'jurusan.id', '=', 'hasil_saw.jurusan_id')
|
||||||
|
->select(
|
||||||
|
'jurusan.nama_jurusan as nama_jurusan',
|
||||||
|
DB::raw('SUM(CASE WHEN tes.minat_jurusan_1_id = hasil_saw.jurusan_id THEN 1 ELSE 0 END) as sesuai'),
|
||||||
|
DB::raw('SUM(CASE WHEN tes.minat_jurusan_1_id != hasil_saw.jurusan_id THEN 1 ELSE 0 END) as berbeda')
|
||||||
|
)
|
||||||
|
->groupBy('jurusan.id', 'jurusan.nama_jurusan')
|
||||||
|
->orderByDesc('sesuai')
|
||||||
|
->get();
|
||||||
|
|
||||||
|
$tren = Tes::selectRaw('MONTH(created_at) as bulan, YEAR(created_at) as tahun, COUNT(*) as total')
|
||||||
|
->where('created_at', '>=', now()->subMonths(7))
|
||||||
|
->groupByRaw('YEAR(created_at), MONTH(created_at)')
|
||||||
|
->orderBy('tahun')->orderBy('bulan')->get();
|
||||||
|
|
||||||
|
return view('pages.bk.statistik', compact('peminatJurusan', 'kesesuaian', 'tren'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
abstract class Controller
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\Jurusan;
|
||||||
|
use App\Models\ArtikelJurusan;
|
||||||
|
|
||||||
|
class JurusanPublikController extends Controller
|
||||||
|
{
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
$jurusan = Jurusan::with([
|
||||||
|
'informasiJurusan',
|
||||||
|
'prospekKerja',
|
||||||
|
])->where('is_active', true)->findOrFail($id);
|
||||||
|
|
||||||
|
$artikels = ArtikelJurusan::with(['gambarUpload', 'fileUpload'])
|
||||||
|
->where('jurusan_id', $id)
|
||||||
|
->latest()
|
||||||
|
->take(6)
|
||||||
|
->get();
|
||||||
|
|
||||||
|
$prospekUmum = $jurusan->prospekKerja->where('tipe', 'umum')->values();
|
||||||
|
$prospekAlumni = $jurusan->prospekKerja->where('tipe', 'alumni')->values();
|
||||||
|
$info = $jurusan->informasiJurusan;
|
||||||
|
|
||||||
|
return view('landingpage.jurusan-detail', compact(
|
||||||
|
'jurusan', 'artikels', 'prospekUmum', 'prospekAlumni', 'info'
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
<?php
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\Jurusan;
|
||||||
|
|
||||||
|
class LandingController extends Controller
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$jurusans = Jurusan::where('is_active', true)
|
||||||
|
->orderBy('nama_jurusan')
|
||||||
|
->get();
|
||||||
|
|
||||||
|
return view('landingpage.home', compact('jurusans'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\Upload;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
|
||||||
|
class MediaController extends Controller
|
||||||
|
{
|
||||||
|
public function artikelGambar(Upload $upload)
|
||||||
|
{
|
||||||
|
abort_unless($upload->isStoredIn('artikel/gambar') && $upload->existsOnPublicDisk(), 404);
|
||||||
|
|
||||||
|
return Storage::disk('public')->response(
|
||||||
|
$upload->normalizedStoragePath(),
|
||||||
|
$upload->file_name,
|
||||||
|
['Content-Type' => $upload->mime_type ?: 'image/jpeg']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function artikelFile(Upload $upload)
|
||||||
|
{
|
||||||
|
abort_unless($upload->isStoredIn('artikel/file') && $upload->existsOnPublicDisk(), 404);
|
||||||
|
|
||||||
|
return Storage::disk('public')->download(
|
||||||
|
$upload->normalizedStoragePath(),
|
||||||
|
$upload->file_name
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,99 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Siswa;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\Siswa;
|
||||||
|
use App\Services\ActivityLogger;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
|
||||||
|
class ProfileController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Tampilkan halaman profil siswa
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$user = Auth::user();
|
||||||
|
$siswa = Siswa::where('user_id', $user->id)->first();
|
||||||
|
|
||||||
|
if (!$siswa) {
|
||||||
|
return redirect()->route('landing.home')
|
||||||
|
->withErrors('Data siswa tidak ditemukan.');
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('pages.siswa.profile', compact('siswa'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update data profil (email, no_telepon, sekolah_asal, jenis_kelamin)
|
||||||
|
* nama diambil dari users.name
|
||||||
|
*/
|
||||||
|
public function update(Request $request)
|
||||||
|
{
|
||||||
|
$user = Auth::user();
|
||||||
|
$siswa = Siswa::where('user_id', $user->id)->firstOrCreate(
|
||||||
|
['user_id' => $user->id],
|
||||||
|
[
|
||||||
|
'no_telepon' => null,
|
||||||
|
'sekolah_asal' => null,
|
||||||
|
'jenis_kelamin' => 'L', // sesuaikan bila perlu, atau pastikan data sudah ada sejak registrasi
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$request->validate([
|
||||||
|
'nama' => 'required|string|max:120',
|
||||||
|
'email' => 'required|email|unique:users,email,' . $user->id,
|
||||||
|
'no_telepon' => 'nullable|string|max:30',
|
||||||
|
'sekolah_asal' => 'nullable|string|max:150',
|
||||||
|
]);
|
||||||
|
|
||||||
|
// update tabel users
|
||||||
|
$user->update([
|
||||||
|
'nama' => $request->nama,
|
||||||
|
'email' => $request->email,
|
||||||
|
]);
|
||||||
|
|
||||||
|
// update tabel siswa
|
||||||
|
$siswa->update([
|
||||||
|
'no_telepon' => $request->no_telepon,
|
||||||
|
'sekolah_asal' => $request->sekolah_asal,
|
||||||
|
]);
|
||||||
|
|
||||||
|
ActivityLogger::log('Siswa edit profil: ' . $user->nama);
|
||||||
|
|
||||||
|
return redirect()->route('siswa.profile')
|
||||||
|
->with('success', 'Profil berhasil diperbarui!');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ubah password
|
||||||
|
*/
|
||||||
|
public function updatePassword(Request $request)
|
||||||
|
{
|
||||||
|
$user = Auth::user();
|
||||||
|
|
||||||
|
$request->validate([
|
||||||
|
'current_password' => ['required', function ($attr, $value, $fail) use ($user) {
|
||||||
|
if (!Hash::check($value, $user->password_hash)) {
|
||||||
|
$fail('Password lama tidak sesuai.');
|
||||||
|
}
|
||||||
|
}],
|
||||||
|
'password' => 'required|string|min:8|confirmed',
|
||||||
|
], [
|
||||||
|
'password.min' => 'Password baru minimal 8 karakter.',
|
||||||
|
'password.confirmed' => 'Konfirmasi password tidak cocok.',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$user->update([
|
||||||
|
'password_hash' => Hash::make($request->password),
|
||||||
|
]);
|
||||||
|
|
||||||
|
ActivityLogger::log('Siswa ubah password');
|
||||||
|
|
||||||
|
return redirect()->route('siswa.profile')
|
||||||
|
->with('success', 'Password berhasil diubah!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,491 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Siswa;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\Siswa;
|
||||||
|
use App\Models\Tes;
|
||||||
|
use App\Models\SoalMinat;
|
||||||
|
use App\Models\JawabanMinat;
|
||||||
|
use App\Models\Jurusan;
|
||||||
|
use App\Models\HasilSaw;
|
||||||
|
use App\Models\Upload;
|
||||||
|
use App\Models\TesPdf;
|
||||||
|
use App\Models\Penyakit;
|
||||||
|
use App\Services\ActivityLogger;
|
||||||
|
use App\Services\TesPdfService;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
|
||||||
|
class SpkController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Tampilkan halaman tes siswa
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$user = Auth::user();
|
||||||
|
|
||||||
|
$siswa = Siswa::with('user')->where('user_id', $user->id)->first();
|
||||||
|
if (!$siswa) {
|
||||||
|
return redirect()->route('landing.home')
|
||||||
|
->withErrors('Akses ditolak: akun ini bukan siswa.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$soal = SoalMinat::where('is_active', true)
|
||||||
|
->orderBy('id')
|
||||||
|
->get();
|
||||||
|
|
||||||
|
if ($soal->count() === 0) {
|
||||||
|
session()->flash('info', 'Belum ada soal minat aktif. Hubungi admin untuk melengkapi data soal.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$tesTerakhir = Tes::with('penyakit')->where('siswa_id', $siswa->id)->latest()->first();
|
||||||
|
|
||||||
|
$riwayatHasil = $tesTerakhir
|
||||||
|
? HasilSaw::where('tes_id', $tesTerakhir->id)->orderBy('peringkat')->get()
|
||||||
|
: collect();
|
||||||
|
|
||||||
|
$jurusan = Jurusan::where('is_active', true)
|
||||||
|
->orderBy('nama_jurusan')
|
||||||
|
->get();
|
||||||
|
$penyakits = Penyakit::where('is_active', true)
|
||||||
|
->orderBy('nama_penyakit')
|
||||||
|
->get();
|
||||||
|
|
||||||
|
return view('pages.siswa.tes', compact(
|
||||||
|
'siswa',
|
||||||
|
'soal',
|
||||||
|
'tesTerakhir',
|
||||||
|
'riwayatHasil',
|
||||||
|
'jurusan',
|
||||||
|
'penyakits'
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simpan tes siswa, jawaban minat, hitung SAW, dan generate PDF
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$user = Auth::user();
|
||||||
|
$siswa = Siswa::with('user')->where('user_id', $user->id)->first();
|
||||||
|
|
||||||
|
if (!$siswa) {
|
||||||
|
return redirect()->route('landing.home')
|
||||||
|
->withErrors('Akses ditolak: akun ini bukan siswa.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$soalAktif = SoalMinat::where('is_active', true)
|
||||||
|
->orderBy('id')
|
||||||
|
->get();
|
||||||
|
|
||||||
|
if ($soalAktif->count() === 0) {
|
||||||
|
return back()
|
||||||
|
->withErrors('Belum ada soal minat aktif. Hubungi admin.')
|
||||||
|
->withInput();
|
||||||
|
}
|
||||||
|
|
||||||
|
$rules = [
|
||||||
|
'jurusan_pilihan_1' => 'required|exists:jurusan,id',
|
||||||
|
'jurusan_pilihan_2' => 'required|exists:jurusan,id|different:jurusan_pilihan_1',
|
||||||
|
|
||||||
|
'tinggi_badan' => 'required|numeric|min:100|max:220',
|
||||||
|
'berat_badan' => 'required|numeric|min:20|max:200',
|
||||||
|
'buta_warna' => 'required|in:ya,tidak',
|
||||||
|
'penyakit_id' => 'nullable|exists:penyakit,id',
|
||||||
|
|
||||||
|
'nilai_matematika' => 'required|numeric|min:0|max:100',
|
||||||
|
'nilai_bahasa_indonesia' => 'required|numeric|min:0|max:100',
|
||||||
|
'nilai_bahasa_inggris' => 'required|numeric|min:0|max:100',
|
||||||
|
'nilai_ipa' => 'required|numeric|min:0|max:100',
|
||||||
|
|
||||||
|
'setuju' => 'required|in:1',
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($soalAktif as $index => $item) {
|
||||||
|
$nomor = $index + 1;
|
||||||
|
$rules["bakat_q{$nomor}"] = 'required|integer|min:1|max:4';
|
||||||
|
}
|
||||||
|
|
||||||
|
$validated = $request->validate($rules);
|
||||||
|
|
||||||
|
$jawabanBakat = [];
|
||||||
|
foreach ($soalAktif as $index => $item) {
|
||||||
|
$nomor = $index + 1;
|
||||||
|
$jawabanBakat[] = (int) $validated["bakat_q{$nomor}"];
|
||||||
|
}
|
||||||
|
|
||||||
|
$sumSkor = array_sum($jawabanBakat);
|
||||||
|
$jumlahSoal = count($jawabanBakat);
|
||||||
|
$skorMinatBakat = (int) round(($sumSkor / ($jumlahSoal * 4)) * 100);
|
||||||
|
|
||||||
|
DB::transaction(function () use ($validated, $siswa, $skorMinatBakat, $jawabanBakat, $soalAktif) {
|
||||||
|
$tes = Tes::create([
|
||||||
|
'siswa_id' => $siswa->id,
|
||||||
|
|
||||||
|
'nilai_matematika' => $validated['nilai_matematika'],
|
||||||
|
'nilai_bahasa_indonesia' => $validated['nilai_bahasa_indonesia'],
|
||||||
|
'nilai_bahasa_inggris' => $validated['nilai_bahasa_inggris'],
|
||||||
|
'nilai_ipa' => $validated['nilai_ipa'],
|
||||||
|
|
||||||
|
'skor_minat_bakat' => $skorMinatBakat,
|
||||||
|
'tinggi_badan' => $validated['tinggi_badan'],
|
||||||
|
'berat_badan' => $validated['berat_badan'],
|
||||||
|
'buta_warna' => ($validated['buta_warna'] === 'ya'),
|
||||||
|
'penyakit_id' => $validated['penyakit_id'] ?? null,
|
||||||
|
|
||||||
|
'minat_jurusan_1_id' => $validated['jurusan_pilihan_1'],
|
||||||
|
'minat_jurusan_2_id' => $validated['jurusan_pilihan_2'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
foreach ($soalAktif as $index => $soal) {
|
||||||
|
JawabanMinat::create([
|
||||||
|
'tes_id' => $tes->id,
|
||||||
|
'soal_minat_id' => $soal->id,
|
||||||
|
'skor' => $jawabanBakat[$index],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->prosesSaw($tes);
|
||||||
|
|
||||||
|
$ok = app(TesPdfService::class)->generateAndStore($tes);
|
||||||
|
|
||||||
|
if (!$ok) {
|
||||||
|
Log::warning('PDF gagal dibuat saat penyimpanan tes', [
|
||||||
|
'tes_id' => $tes->id,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
ActivityLogger::log("Siswa cek minat bakat: skor {$skorMinatBakat}");
|
||||||
|
|
||||||
|
return redirect()->route('siswa.tes.hasil');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Proses SAW:
|
||||||
|
* - Alternatif = jurusan
|
||||||
|
* - Kriteria = 8 kriteria final
|
||||||
|
* - Aturan wajib_lolos diperlakukan sebagai aturan bisnis tambahan
|
||||||
|
*/
|
||||||
|
private function prosesSaw(Tes $tes): void
|
||||||
|
{
|
||||||
|
$jurusans = Jurusan::with(['jurusanKriteria.kriteria', 'penyakit'])
|
||||||
|
->where('is_active', true)
|
||||||
|
->get();
|
||||||
|
|
||||||
|
// ambil nilai siswa (0–1)
|
||||||
|
$nilaiDasar = $this->getNilaiKriteriaSiswa($tes);
|
||||||
|
|
||||||
|
$rows = [];
|
||||||
|
|
||||||
|
foreach ($jurusans as $jurusan) {
|
||||||
|
|
||||||
|
// 🔵 mapping kriteria biar rapi
|
||||||
|
$map = $this->mapJurusanKriteriaByKode($jurusan);
|
||||||
|
$nilai = $nilaiDasar;
|
||||||
|
$nilai['C8'] = $this->getSkorPenyakitUntukJurusan($tes, $jurusan);
|
||||||
|
|
||||||
|
// 🔴 1. WAJIB LOLOS (HARD CONSTRAINT)
|
||||||
|
if ($this->isJurusanDiskualifikasi($map, $nilai)) {
|
||||||
|
$rows[] = [
|
||||||
|
'jurusan_id' => $jurusan->id,
|
||||||
|
'nilai_preferensi' => 0,
|
||||||
|
];
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$nilaiPreferensi = 0;
|
||||||
|
|
||||||
|
// 🔵 2. LOOP KRITERIA
|
||||||
|
foreach ($map as $kode => $jk) {
|
||||||
|
|
||||||
|
if (!isset($nilai[$kode])) continue;
|
||||||
|
|
||||||
|
$nilaiSiswa = $nilai[$kode];
|
||||||
|
$bobot = (float) $jk->bobot;
|
||||||
|
|
||||||
|
// 🟡 3. PENYESUAIAN MIN & MAX
|
||||||
|
$nilaiFix = $this->hitungNilaiKecocokan(
|
||||||
|
$nilaiSiswa,
|
||||||
|
$jk->nilai_min,
|
||||||
|
$jk->nilai_max,
|
||||||
|
$kode
|
||||||
|
);
|
||||||
|
|
||||||
|
// 🟢 4. RUMUS SAW (TETAP)
|
||||||
|
$nilaiPreferensi += $bobot * $nilaiFix;
|
||||||
|
}
|
||||||
|
|
||||||
|
$rows[] = [
|
||||||
|
'jurusan_id' => $jurusan->id,
|
||||||
|
'nilai_preferensi' => round($nilaiPreferensi, 6),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 🔽 SORTING
|
||||||
|
usort($rows, fn($a, $b) => $b['nilai_preferensi'] <=> $a['nilai_preferensi']);
|
||||||
|
|
||||||
|
// 🔄 SIMPAN ULANG
|
||||||
|
HasilSaw::where('tes_id', $tes->id)->delete();
|
||||||
|
|
||||||
|
foreach ($rows as $i => $row) {
|
||||||
|
HasilSaw::create([
|
||||||
|
'tes_id' => $tes->id,
|
||||||
|
'jurusan_id' => $row['jurusan_id'],
|
||||||
|
'nilai_preferensi' => $row['nilai_preferensi'],
|
||||||
|
'peringkat' => $i + 1,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Nilai final 8 kriteria siswa (Normalisasi 0-1)
|
||||||
|
*/
|
||||||
|
private function getNilaiKriteriaSiswa(Tes $tes): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'C1' => $tes->nilai_matematika / 100,
|
||||||
|
'C2' => $tes->nilai_bahasa_indonesia / 100,
|
||||||
|
'C3' => $tes->nilai_ipa / 100,
|
||||||
|
'C4' => $tes->nilai_bahasa_inggris / 100,
|
||||||
|
'C5' => $this->getSkorFisikDariBmi($tes->tinggi_badan, $tes->berat_badan) / 100,
|
||||||
|
'C6' => $tes->buta_warna ? 0 : 1,
|
||||||
|
'C7' => $tes->skor_minat_bakat / 100,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getSkorPenyakitUntukJurusan(Tes $tes, Jurusan $jurusan): int
|
||||||
|
{
|
||||||
|
if (!$tes->penyakit_id) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $jurusan->penyakit->contains('id', $tes->penyakit_id) ? 0 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hitung BMI siswa
|
||||||
|
*/
|
||||||
|
private function hitungBmi(float $tinggiBadan, float $beratBadan): float
|
||||||
|
{
|
||||||
|
$tinggiMeter = $tinggiBadan / 100;
|
||||||
|
if ($tinggiMeter <= 0) return 0;
|
||||||
|
return round($beratBadan / ($tinggiMeter * $tinggiMeter), 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Konversi BMI menjadi skor fisik
|
||||||
|
*/
|
||||||
|
private function getSkorFisikDariBmi(float $tinggiBadan, float $beratBadan): int
|
||||||
|
{
|
||||||
|
$bmi = $this->hitungBmi($tinggiBadan, $beratBadan);
|
||||||
|
|
||||||
|
if ($bmi >= 18.5 && $bmi <= 24.9) {
|
||||||
|
return 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($bmi >= 25 && $bmi <= 29.9) {
|
||||||
|
return 80;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 70;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ubah koleksi jurusanKriteria menjadi map berdasarkan kode kriteria
|
||||||
|
*/
|
||||||
|
private function mapJurusanKriteriaByKode($jurusan): array
|
||||||
|
{
|
||||||
|
$map = [];
|
||||||
|
foreach ($jurusan->jurusanKriteria as $jurusanKriteria) {
|
||||||
|
$kode = $jurusanKriteria->kriteria?->kode_kriteria;
|
||||||
|
if ($kode) {
|
||||||
|
$map[$kode] = $jurusanKriteria;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $map;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hitung nilai kecocokan siswa terhadap aturan jurusan
|
||||||
|
*/
|
||||||
|
private function hitungNilaiKecocokan(float $nilaiSiswa, $nilaiMin = null, $nilaiMax = null, $kodeKriteria = null): float
|
||||||
|
{
|
||||||
|
// Khusus C6 & C8 adalah biner (0/1), kriteria lain 0-100 di database
|
||||||
|
$isBinary = in_array($kodeKriteria, ['C6', 'C8']);
|
||||||
|
$divider = $isBinary ? 1 : 100;
|
||||||
|
|
||||||
|
$nilaiMin = is_null($nilaiMin) ? null : $nilaiMin / $divider;
|
||||||
|
$nilaiMax = is_null($nilaiMax) ? null : $nilaiMax / $divider;
|
||||||
|
|
||||||
|
$score = $nilaiSiswa;
|
||||||
|
|
||||||
|
// 🔻 Jika di bawah minimum → penalti
|
||||||
|
if (!is_null($nilaiMin) && $nilaiMin > 0 && $nilaiSiswa < $nilaiMin) {
|
||||||
|
$score = ($nilaiSiswa / $nilaiMin) * $nilaiSiswa;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 🔺 Jika di atas maksimum → penalti
|
||||||
|
if (!is_null($nilaiMax) && $nilaiSiswa > 0 && $nilaiSiswa > $nilaiMax) {
|
||||||
|
$score = ($nilaiMax / $nilaiSiswa) * $score;
|
||||||
|
}
|
||||||
|
|
||||||
|
return round(max($score, 0), 6);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Aturan bisnis tambahan:
|
||||||
|
* Jika kriteria wajib_lolos tidak terpenuhi, jurusan didiskualifikasi.
|
||||||
|
*/
|
||||||
|
private function isJurusanDiskualifikasi(array $mapJurusanKriteria, array $nilaiSiswa): bool
|
||||||
|
{
|
||||||
|
foreach ($mapJurusanKriteria as $kode => $jurusanKriteria) {
|
||||||
|
if (!(bool) $jurusanKriteria->wajib_lolos) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$nilai = $nilaiSiswa[$kode] ?? null;
|
||||||
|
if (is_null($nilai)) continue;
|
||||||
|
|
||||||
|
// C6 & C8 biner (0/1), sisanya 0-100 di database
|
||||||
|
$isBinary = in_array($kode, ['C6', 'C8']);
|
||||||
|
$divider = $isBinary ? 1 : 100;
|
||||||
|
|
||||||
|
$nilaiMin = is_null($jurusanKriteria->nilai_min) ? null : $jurusanKriteria->nilai_min / $divider;
|
||||||
|
$nilaiMax = is_null($jurusanKriteria->nilai_max) ? null : $jurusanKriteria->nilai_max / $divider;
|
||||||
|
|
||||||
|
if (!is_null($nilaiMin) && $nilai < $nilaiMin) return true;
|
||||||
|
if (!is_null($nilaiMax) && $nilai > $nilaiMax) return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tampilkan hasil tes terakhir
|
||||||
|
*/
|
||||||
|
public function hasil()
|
||||||
|
{
|
||||||
|
$user = Auth::user();
|
||||||
|
$siswa = Siswa::with('user')->where('user_id', $user->id)->first();
|
||||||
|
|
||||||
|
if (!$siswa) {
|
||||||
|
return redirect()->route('landing.home')
|
||||||
|
->withErrors('Akses ditolak: akun ini bukan siswa.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$tesTerakhir = Tes::where('siswa_id', $siswa->id)->latest()->first();
|
||||||
|
if (!$tesTerakhir) {
|
||||||
|
return redirect()->route('siswa.tes.index');
|
||||||
|
}
|
||||||
|
|
||||||
|
$hasilList = HasilSaw::where('tes_id', $tesTerakhir->id)
|
||||||
|
->with('jurusan')
|
||||||
|
->orderBy('peringkat')
|
||||||
|
->get();
|
||||||
|
|
||||||
|
if ($hasilList->isEmpty()) {
|
||||||
|
return redirect()->route('siswa.tes.index');
|
||||||
|
}
|
||||||
|
|
||||||
|
$jurusanPilihan1 = Jurusan::find($tesTerakhir->minat_jurusan_1_id);
|
||||||
|
$jurusanPilihan2 = Jurusan::find($tesTerakhir->minat_jurusan_2_id);
|
||||||
|
|
||||||
|
$skorPilihan1 = $tesTerakhir->minat_jurusan_1_id
|
||||||
|
? $hasilList->firstWhere('jurusan_id', $tesTerakhir->minat_jurusan_1_id)
|
||||||
|
: null;
|
||||||
|
|
||||||
|
$skorPilihan2 = $tesTerakhir->minat_jurusan_2_id
|
||||||
|
? $hasilList->firstWhere('jurusan_id', $tesTerakhir->minat_jurusan_2_id)
|
||||||
|
: null;
|
||||||
|
|
||||||
|
return view('pages.siswa.hasil', compact(
|
||||||
|
'siswa',
|
||||||
|
'tesTerakhir',
|
||||||
|
'hasilList',
|
||||||
|
'jurusanPilihan1',
|
||||||
|
'jurusanPilihan2',
|
||||||
|
'skorPilihan1',
|
||||||
|
'skorPilihan2'
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Download PDF hasil tes terakhir
|
||||||
|
*/
|
||||||
|
public function cetakPdf()
|
||||||
|
{
|
||||||
|
$user = Auth::user();
|
||||||
|
$siswa = Siswa::where('user_id', $user->id)->first();
|
||||||
|
if (!$siswa) abort(403);
|
||||||
|
|
||||||
|
$tes = Tes::with('penyakit')->where('siswa_id', $siswa->id)->latest()->first();
|
||||||
|
if (!$tes) abort(404);
|
||||||
|
|
||||||
|
$tesPdf = app(TesPdfService::class)->ensureAvailable($tes);
|
||||||
|
if (!$tesPdf?->upload || !$tesPdf->upload->existsOnPublicDisk()) {
|
||||||
|
return redirect()->route('siswa.tes.hasil')->withErrors('File PDF tidak ditemukan.');
|
||||||
|
}
|
||||||
|
|
||||||
|
return Storage::disk('public')->download(
|
||||||
|
$tesPdf->upload->normalizedStoragePath(),
|
||||||
|
'hasil_tes_' . $tes->id . '.pdf'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Riwayat tes siswa
|
||||||
|
*/
|
||||||
|
public function history()
|
||||||
|
{
|
||||||
|
$siswa = Siswa::where('user_id', Auth::id())->first();
|
||||||
|
if (!$siswa) return view('pages.siswa.history', ['histories' => collect()]);
|
||||||
|
|
||||||
|
$histories = Tes::where('siswa_id', $siswa->id)
|
||||||
|
->with(['hasilSaw.jurusan', 'tesPDF.upload', 'penyakit'])
|
||||||
|
->latest()
|
||||||
|
->paginate(10);
|
||||||
|
|
||||||
|
return view('pages.siswa.history', compact('histories'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function hasilByTes(Tes $tes)
|
||||||
|
{
|
||||||
|
$user = Auth::user();
|
||||||
|
$siswa = Siswa::where('user_id', $user->id)->first();
|
||||||
|
if (!$siswa || $tes->siswa_id != $siswa->id) abort(403);
|
||||||
|
|
||||||
|
$tes->loadMissing('penyakit');
|
||||||
|
$hasilList = HasilSaw::where('tes_id', $tes->id)->with('jurusan')->orderBy('peringkat')->get();
|
||||||
|
|
||||||
|
if ($hasilList->isEmpty()) return redirect()->route('siswa.tes.index');
|
||||||
|
|
||||||
|
$jurusanPilihan1 = Jurusan::find($tes->minat_jurusan_1_id);
|
||||||
|
$jurusanPilihan2 = Jurusan::find($tes->minat_jurusan_2_id);
|
||||||
|
$skorPilihan1 = $hasilList->firstWhere('jurusan_id', $tes->minat_jurusan_1_id);
|
||||||
|
$skorPilihan2 = $hasilList->firstWhere('jurusan_id', $tes->minat_jurusan_2_id);
|
||||||
|
|
||||||
|
return view('pages.siswa.hasil', compact('siswa', 'tes', 'hasilList', 'jurusanPilihan1', 'jurusanPilihan2', 'skorPilihan1', 'skorPilihan2'))->with('tesTerakhir', $tes);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function cetakPdfByTes(Tes $tes)
|
||||||
|
{
|
||||||
|
$siswa = Siswa::where('user_id', Auth::id())->first();
|
||||||
|
if (!$siswa || $tes->siswa_id != $siswa->id) abort(403);
|
||||||
|
|
||||||
|
$tesPdf = app(TesPdfService::class)->ensureAvailable($tes);
|
||||||
|
if (!$tesPdf?->upload || !$tesPdf->upload->existsOnPublicDisk()) {
|
||||||
|
return back()->withErrors('File PDF tidak tersedia.');
|
||||||
|
}
|
||||||
|
|
||||||
|
return Storage::disk('public')->download(
|
||||||
|
$tesPdf->upload->normalizedStoragePath(),
|
||||||
|
'hasil_tes_' . $tes->id . '.pdf'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
|
||||||
|
class EnsureGuruBkOnboarding
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Handle an incoming request.
|
||||||
|
*
|
||||||
|
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
|
||||||
|
*/
|
||||||
|
public function handle(Request $request, Closure $next): Response
|
||||||
|
{
|
||||||
|
return $next($request);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,52 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
|
class ForcePasswordChange
|
||||||
|
{
|
||||||
|
public function handle(Request $request, Closure $next)
|
||||||
|
{
|
||||||
|
$user = Auth::user();
|
||||||
|
|
||||||
|
if (!$user) {
|
||||||
|
return $next($request);
|
||||||
|
}
|
||||||
|
|
||||||
|
$user->loadMissing(['role', 'guruBk']);
|
||||||
|
|
||||||
|
// Kalau bukan Guru BK, biarkan lewat
|
||||||
|
if (!$user->isGuruBk()) {
|
||||||
|
return $next($request);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Route yang tetap boleh diakses walaupun onboarding belum selesai
|
||||||
|
if (
|
||||||
|
$request->routeIs('bk.password.*') ||
|
||||||
|
$request->routeIs('bk.profil') ||
|
||||||
|
$request->routeIs('bk.profil.update') ||
|
||||||
|
$request->routeIs('logout')
|
||||||
|
) {
|
||||||
|
return $next($request);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Kalau profil belum lengkap, arahkan ke halaman profil
|
||||||
|
if ($user->isGuruBkProfileIncomplete()) {
|
||||||
|
return redirect()
|
||||||
|
->route('bk.profil')
|
||||||
|
->with('warning', 'Lengkapi data Guru BK terlebih dahulu.');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Kalau password masih wajib diganti, arahkan ke halaman ubah password
|
||||||
|
if ($user->must_change_password) {
|
||||||
|
return redirect()
|
||||||
|
->route('bk.password.index')
|
||||||
|
->with('warning', 'Anda wajib mengganti password terlebih dahulu.');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $next($request);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,85 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Requests\Auth;
|
||||||
|
|
||||||
|
use Illuminate\Auth\Events\Lockout;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\RateLimiter;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
use Illuminate\Validation\ValidationException;
|
||||||
|
|
||||||
|
class LoginRequest extends FormRequest
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Determine if the user is authorized to make this request.
|
||||||
|
*/
|
||||||
|
public function authorize(): bool
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the validation rules that apply to the request.
|
||||||
|
*
|
||||||
|
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||||||
|
*/
|
||||||
|
public function rules(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'email' => ['required', 'string', 'email'],
|
||||||
|
'password' => ['required', 'string'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attempt to authenticate the request's credentials.
|
||||||
|
*
|
||||||
|
* @throws \Illuminate\Validation\ValidationException
|
||||||
|
*/
|
||||||
|
public function authenticate(): void
|
||||||
|
{
|
||||||
|
$this->ensureIsNotRateLimited();
|
||||||
|
|
||||||
|
if (! Auth::attempt($this->only('email', 'password'), $this->boolean('remember'))) {
|
||||||
|
RateLimiter::hit($this->throttleKey());
|
||||||
|
|
||||||
|
throw ValidationException::withMessages([
|
||||||
|
'email' => trans('auth.failed'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
RateLimiter::clear($this->throttleKey());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ensure the login request is not rate limited.
|
||||||
|
*
|
||||||
|
* @throws \Illuminate\Validation\ValidationException
|
||||||
|
*/
|
||||||
|
public function ensureIsNotRateLimited(): void
|
||||||
|
{
|
||||||
|
if (! RateLimiter::tooManyAttempts($this->throttleKey(), 5)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
event(new Lockout($this));
|
||||||
|
|
||||||
|
$seconds = RateLimiter::availableIn($this->throttleKey());
|
||||||
|
|
||||||
|
throw ValidationException::withMessages([
|
||||||
|
'email' => trans('auth.throttle', [
|
||||||
|
'seconds' => $seconds,
|
||||||
|
'minutes' => ceil($seconds / 60),
|
||||||
|
]),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the rate limiting throttle key for the request.
|
||||||
|
*/
|
||||||
|
public function throttleKey(): string
|
||||||
|
{
|
||||||
|
return Str::transliterate(Str::lower($this->string('email')).'|'.$this->ip());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Requests;
|
||||||
|
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
use Illuminate\Validation\Rule;
|
||||||
|
|
||||||
|
class ProfileUpdateRequest extends FormRequest
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the validation rules that apply to the request.
|
||||||
|
*
|
||||||
|
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||||||
|
*/
|
||||||
|
public function rules(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'name' => ['required', 'string', 'max:255'],
|
||||||
|
'email' => [
|
||||||
|
'required',
|
||||||
|
'string',
|
||||||
|
'lowercase',
|
||||||
|
'email',
|
||||||
|
'max:255',
|
||||||
|
Rule::unique(User::class)->ignore($this->user()->id),
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?php
|
||||||
|
// app/Mail/OtpVerificationMail.php
|
||||||
|
|
||||||
|
namespace App\Mail;
|
||||||
|
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Mail\Mailable;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
class OtpVerificationMail extends Mailable
|
||||||
|
{
|
||||||
|
use SerializesModels;
|
||||||
|
|
||||||
|
public function __construct(
|
||||||
|
public User $user,
|
||||||
|
public string $otp
|
||||||
|
) {}
|
||||||
|
|
||||||
|
public function build()
|
||||||
|
{
|
||||||
|
return $this->subject('Kode OTP Login - SPK SMKN 2 Jember')
|
||||||
|
->view('emails.otp');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class ActivityLog extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'activity_log';
|
||||||
|
|
||||||
|
protected $fillable = ['user_id', 'aksi'];
|
||||||
|
|
||||||
|
public function user()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(User::class);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Admin extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'admin';
|
||||||
|
|
||||||
|
protected $fillable = ['user_id'];
|
||||||
|
|
||||||
|
public function user()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(User::class);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
<?php
|
||||||
|
namespace App\Models;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class ArtikelJurusan extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'artikel_jurusan';
|
||||||
|
protected $fillable = [
|
||||||
|
'jurusan_id', 'judul', 'deskripsi',
|
||||||
|
'file_upload_id', 'gambar_upload_id', 'created_by_user_id',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function jurusan() { return $this->belongsTo(Jurusan::class); }
|
||||||
|
public function creator() { return $this->belongsTo(User::class, 'created_by_user_id'); }
|
||||||
|
public function fileUpload() { return $this->belongsTo(Upload::class, 'file_upload_id'); }
|
||||||
|
public function gambarUpload() { return $this->belongsTo(Upload::class, 'gambar_upload_id'); }
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class GuruBk extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'guru_bk';
|
||||||
|
|
||||||
|
protected $fillable = ['user_id', 'nip', 'jurusan_id'];
|
||||||
|
|
||||||
|
public function user()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(User::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function jurusan()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Jurusan::class);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class HasilSaw extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'hasil_saw';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'tes_id',
|
||||||
|
'jurusan_id',
|
||||||
|
'nilai_preferensi',
|
||||||
|
'peringkat'
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'nilai_preferensi' => 'decimal:6',
|
||||||
|
'peringkat' => 'integer',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function tes()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Tes::class, 'tes_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function jurusan()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Jurusan::class);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class InformasiJurusan extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'informasi_jurusan';
|
||||||
|
protected $primaryKey = 'jurusan_id';
|
||||||
|
public $incrementing = false;
|
||||||
|
protected $fillable = ['jurusan_id', 'fasilitas', 'updated_by_user_id'];
|
||||||
|
|
||||||
|
public function jurusan() { return $this->belongsTo(Jurusan::class); }
|
||||||
|
public function updatedBy() { return $this->belongsTo(User::class, 'updated_by_user_id'); }
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class JawabanMinat extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'jawaban_minat';
|
||||||
|
|
||||||
|
protected $fillable = ['tes_id', 'soal_minat_id', 'skor'];
|
||||||
|
|
||||||
|
public function tes()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Tes::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function soal()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(SoalMinat::class, 'soal_minat_id');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,49 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Jurusan extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'jurusan';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'nama_jurusan',
|
||||||
|
'is_active',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'is_active' => 'boolean',
|
||||||
|
];
|
||||||
|
public function guruBk()
|
||||||
|
{
|
||||||
|
return $this->hasMany(GuruBk::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function jurusanKriteria()
|
||||||
|
{
|
||||||
|
return $this->hasMany(JurusanKriteria::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function penyakit()
|
||||||
|
{
|
||||||
|
return $this->belongsToMany(Penyakit::class, 'jurusan_penyakit')
|
||||||
|
->withTimestamps();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function informasiJurusan()
|
||||||
|
{
|
||||||
|
return $this->hasOne(InformasiJurusan::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function prospekKerja()
|
||||||
|
{
|
||||||
|
return $this->hasMany(ProspekKerja::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function artikelJurusan()
|
||||||
|
{
|
||||||
|
return $this->hasMany(ArtikelJurusan::class);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
|
||||||
|
class JurusanKriteria extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'jurusan_kriteria';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'jurusan_id',
|
||||||
|
'kriteria_id',
|
||||||
|
'bobot',
|
||||||
|
'wajib_lolos',
|
||||||
|
'nilai_min',
|
||||||
|
'nilai_max',
|
||||||
|
];
|
||||||
|
protected $casts = [
|
||||||
|
'wajib_lolos' => 'boolean',
|
||||||
|
'nilai_min' => 'decimal:2',
|
||||||
|
'nilai_max' => 'decimal:2',
|
||||||
|
];
|
||||||
|
public function jurusan()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Jurusan::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function kriteria()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Kriteria::class);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Kriteria extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'kriteria';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'kode_kriteria',
|
||||||
|
'nama_kriteria',
|
||||||
|
'is_active',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'is_active' => 'boolean',
|
||||||
|
];
|
||||||
|
public function jurusanKriteria()
|
||||||
|
{
|
||||||
|
return $this->hasMany(JurusanKriteria::class);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class PasswordReset extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'password_resets';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'user_id',
|
||||||
|
'otp_code',
|
||||||
|
'expires_at',
|
||||||
|
'is_used'
|
||||||
|
];
|
||||||
|
|
||||||
|
public function user()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(User::class);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Penyakit extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'penyakit';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'nama_penyakit',
|
||||||
|
'is_active',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'is_active' => 'boolean',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function jurusans()
|
||||||
|
{
|
||||||
|
return $this->belongsToMany(Jurusan::class, 'jurusan_penyakit')
|
||||||
|
->withTimestamps();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function tes()
|
||||||
|
{
|
||||||
|
return $this->hasMany(Tes::class);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class ProspekKerja extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'prospek_kerja';
|
||||||
|
|
||||||
|
protected $fillable = ['jurusan_id', 'tipe', 'isi'];
|
||||||
|
|
||||||
|
public function jurusan()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Jurusan::class);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
|
|
||||||
|
class Role extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'roles';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'nama_role',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function users(): HasMany
|
||||||
|
{
|
||||||
|
return $this->hasMany(User::class, 'role_id');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Siswa extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'siswa';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'user_id',
|
||||||
|
'sekolah_asal',
|
||||||
|
'jenis_kelamin',
|
||||||
|
'no_telepon',
|
||||||
|
'alamat',
|
||||||
|
];
|
||||||
|
|
||||||
|
// timestamps default true, cocok migration
|
||||||
|
|
||||||
|
public function user()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(User::class, 'user_id'); // user_id -> users.id
|
||||||
|
}
|
||||||
|
|
||||||
|
public function tes()
|
||||||
|
{
|
||||||
|
return $this->hasMany(Tes::class, 'siswa_id'); // siswa_id di tes -> siswa.id
|
||||||
|
}
|
||||||
|
|
||||||
|
public function tesTerakhir()
|
||||||
|
{
|
||||||
|
return $this->hasOne(Tes::class, 'siswa_id')->latestOfMany();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class SoalMinat extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'soal_minat';
|
||||||
|
|
||||||
|
protected $fillable = ['pertanyaan', 'is_active'];
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'is_active' => 'boolean',
|
||||||
|
];
|
||||||
|
public function jawaban()
|
||||||
|
{
|
||||||
|
return $this->hasMany(JawabanMinat::class);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,80 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Tes extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'tes';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'siswa_id',
|
||||||
|
|
||||||
|
'nilai_matematika',
|
||||||
|
'nilai_bahasa_indonesia',
|
||||||
|
'nilai_bahasa_inggris',
|
||||||
|
'nilai_ipa',
|
||||||
|
|
||||||
|
'skor_minat_bakat',
|
||||||
|
'tinggi_badan',
|
||||||
|
'berat_badan',
|
||||||
|
'buta_warna',
|
||||||
|
'penyakit_id',
|
||||||
|
'minat_jurusan_1_id',
|
||||||
|
'minat_jurusan_2_id',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'buta_warna' => 'boolean',
|
||||||
|
'nilai_matematika' => 'decimal:2',
|
||||||
|
'nilai_bahasa_indonesia' => 'decimal:2',
|
||||||
|
'nilai_bahasa_inggris' => 'decimal:2',
|
||||||
|
'nilai_ipa' => 'decimal:2',
|
||||||
|
'tinggi_badan' => 'decimal:2',
|
||||||
|
'berat_badan' => 'decimal:2',
|
||||||
|
'skor_minat_bakat' => 'integer',
|
||||||
|
'penyakit_id' => 'integer',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function siswa()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Siswa::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function jawabanMinat()
|
||||||
|
{
|
||||||
|
return $this->hasMany(JawabanMinat::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function hasilSaw()
|
||||||
|
{
|
||||||
|
return $this->hasMany(HasilSaw::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function penyakit()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Penyakit::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function tesPDF()
|
||||||
|
{
|
||||||
|
return $this->hasOne(TesPdf::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function rekomendasiTeratas()
|
||||||
|
{
|
||||||
|
return $this->hasOne(HasilSaw::class, 'tes_id')
|
||||||
|
->where('peringkat', 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function minatJurusan1()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Jurusan::class, 'minat_jurusan_1_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function minatJurusan2()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Jurusan::class, 'minat_jurusan_2_id');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class TesPdf extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'tes_pdf';
|
||||||
|
protected $primaryKey = 'tes_id';
|
||||||
|
public $incrementing = false;
|
||||||
|
public $timestamps = false;
|
||||||
|
|
||||||
|
protected $fillable = ['tes_id', 'upload_id', 'generated_at'];
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'generated_at' => 'datetime',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function upload()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Upload::class, 'upload_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function tes()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Tes::class, 'tes_id');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,57 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
|
||||||
|
class Upload extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'uploads';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'uploader_user_id',
|
||||||
|
'file_name',
|
||||||
|
'ext',
|
||||||
|
'mime_type',
|
||||||
|
'size_mb',
|
||||||
|
'storage_path'
|
||||||
|
];
|
||||||
|
|
||||||
|
public function uploader()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(User::class, 'uploader_user_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function normalizedStoragePath(): string
|
||||||
|
{
|
||||||
|
$path = ltrim((string) $this->storage_path, '/\\');
|
||||||
|
|
||||||
|
foreach (['storage/', 'public/'] as $prefix) {
|
||||||
|
if (str_starts_with($path, $prefix)) {
|
||||||
|
$path = substr($path, strlen($prefix));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return str_replace('\\', '/', $path);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function existsOnPublicDisk(): bool
|
||||||
|
{
|
||||||
|
$path = $this->normalizedStoragePath();
|
||||||
|
|
||||||
|
return $path !== '' && Storage::disk('public')->exists($path);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function publicDiskPath(): string
|
||||||
|
{
|
||||||
|
return Storage::disk('public')->path($this->normalizedStoragePath());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isStoredIn(string $directory): bool
|
||||||
|
{
|
||||||
|
$directory = trim(str_replace('\\', '/', $directory), '/');
|
||||||
|
|
||||||
|
return str_starts_with($this->normalizedStoragePath(), $directory . '/');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,94 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||||
|
use Illuminate\Notifications\Notifiable;
|
||||||
|
use App\Notifications\CustomResetPasswordNotification;
|
||||||
|
|
||||||
|
class User extends Authenticatable
|
||||||
|
{
|
||||||
|
use Notifiable;
|
||||||
|
|
||||||
|
protected $table = 'users';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'role_id',
|
||||||
|
'nama',
|
||||||
|
'email',
|
||||||
|
'password_hash',
|
||||||
|
'is_active',
|
||||||
|
'must_change_password',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $hidden = [
|
||||||
|
'password_hash',
|
||||||
|
'remember_token',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'is_active' => 'boolean',
|
||||||
|
'must_change_password' => 'boolean',
|
||||||
|
];
|
||||||
|
|
||||||
|
// Laravel Auth default cari kolom "password", jadi diarahkan ke "password_hash"
|
||||||
|
public function getAuthPassword(): string
|
||||||
|
{
|
||||||
|
return $this->password_hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function role()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Role::class, 'role_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function siswa()
|
||||||
|
{
|
||||||
|
return $this->hasOne(Siswa::class, 'user_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function guruBk()
|
||||||
|
{
|
||||||
|
return $this->hasOne(GuruBk::class, 'user_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function admin()
|
||||||
|
{
|
||||||
|
return $this->hasOne(Admin::class, 'user_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isGuruBk(): bool
|
||||||
|
{
|
||||||
|
return optional($this->role)->nama_role === 'guru_bk';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isSiswa(): bool
|
||||||
|
{
|
||||||
|
return optional($this->role)->nama_role === 'siswa';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isAdmin(): bool
|
||||||
|
{
|
||||||
|
return optional($this->role)->nama_role === 'admin';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isGuruBkProfileIncomplete(): bool
|
||||||
|
{
|
||||||
|
if (!$this->isGuruBk()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$guruBk = $this->guruBk;
|
||||||
|
|
||||||
|
if (!$guruBk) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return blank($guruBk->nip);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function sendPasswordResetNotification($token)
|
||||||
|
{
|
||||||
|
$this->notify(new CustomResetPasswordNotification($token));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Notifications;
|
||||||
|
|
||||||
|
use Illuminate\Auth\Notifications\ResetPassword as ResetPasswordNotification;
|
||||||
|
use Illuminate\Notifications\Messages\MailMessage;
|
||||||
|
|
||||||
|
class CustomResetPasswordNotification extends ResetPasswordNotification
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Build the mail representation of the notification.
|
||||||
|
*/
|
||||||
|
public function toMail($notifiable): MailMessage
|
||||||
|
{
|
||||||
|
$url = url(route('password.reset', [
|
||||||
|
'token' => $this->token,
|
||||||
|
'email' => $notifiable->getEmailForPasswordReset(),
|
||||||
|
], false));
|
||||||
|
|
||||||
|
return (new MailMessage)
|
||||||
|
->subject('Atur Ulang Password - SPK SMKN 2 Jember')
|
||||||
|
->view('emails.reset-password', [
|
||||||
|
'url' => $url,
|
||||||
|
'nama' => $notifiable->nama,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Pagination\Paginator;
|
||||||
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
|
||||||
|
class AppServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Register any application services.
|
||||||
|
*/
|
||||||
|
public function register(): void
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bootstrap any application services.
|
||||||
|
*/
|
||||||
|
public function boot(): void
|
||||||
|
{
|
||||||
|
Paginator::defaultView('vendor.pagination.custom');
|
||||||
|
Paginator::defaultSimpleView('vendor.pagination.simple-custom');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Services;
|
||||||
|
|
||||||
|
use App\Models\ActivityLog;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
class ActivityLogger
|
||||||
|
{
|
||||||
|
public static function log(string $aksi, ?int $userId = null): void
|
||||||
|
{
|
||||||
|
$userId ??= Auth::id();
|
||||||
|
|
||||||
|
if (!$userId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
ActivityLog::create([
|
||||||
|
'user_id' => $userId,
|
||||||
|
'aksi' => Str::limit($aksi, 60, ''),
|
||||||
|
]);
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
Log::warning('Activity log gagal dibuat', [
|
||||||
|
'error' => $e->getMessage(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,55 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Services;
|
||||||
|
|
||||||
|
use App\Mail\OtpVerificationMail;
|
||||||
|
use App\Models\PasswordReset;
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
use Illuminate\Support\Facades\Mail;
|
||||||
|
|
||||||
|
class OtpService
|
||||||
|
{
|
||||||
|
public function generate(User $user): string
|
||||||
|
{
|
||||||
|
// Hapus OTP lama
|
||||||
|
PasswordReset::where('user_id', $user->id)->delete();
|
||||||
|
|
||||||
|
$code = str_pad(random_int(0, 999999), 6, '0', STR_PAD_LEFT);
|
||||||
|
|
||||||
|
PasswordReset::create([
|
||||||
|
'user_id' => $user->id,
|
||||||
|
'otp_code' => Hash::make($code),
|
||||||
|
'expires_at' => now()->addMinutes(2),
|
||||||
|
'is_used' => false,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return $code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function verify(User $user, string $code): bool
|
||||||
|
{
|
||||||
|
$otp = PasswordReset::where('user_id', $user->id)
|
||||||
|
->where('is_used', false)
|
||||||
|
->latest()
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if (!$otp) return false;
|
||||||
|
if (now()->isAfter($otp->expires_at)) return false;
|
||||||
|
if (!Hash::check($code, $otp->otp_code)) return false;
|
||||||
|
|
||||||
|
$otp->update(['is_used' => true]);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function sendEmail(User $user, string $code): bool
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
Mail::to($user->email)->send(new OtpVerificationMail($user, $code));
|
||||||
|
return true;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
// Log error jika diperlukan: \Log::error("Gagal mengirim OTP: " . $e->getMessage());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,90 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Services;
|
||||||
|
|
||||||
|
use App\Models\HasilSaw;
|
||||||
|
use App\Models\Tes;
|
||||||
|
use App\Models\TesPdf;
|
||||||
|
use App\Models\Upload;
|
||||||
|
use Barryvdh\DomPDF\Facade\Pdf;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
|
||||||
|
class TesPdfService
|
||||||
|
{
|
||||||
|
public function ensureAvailable(Tes $tes): ?TesPdf
|
||||||
|
{
|
||||||
|
$tesPdf = TesPdf::with('upload')->where('tes_id', $tes->id)->first();
|
||||||
|
|
||||||
|
if ($tesPdf?->upload && $tesPdf->upload->existsOnPublicDisk()) {
|
||||||
|
return $tesPdf;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$this->generateAndStore($tes)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TesPdf::with('upload')->where('tes_id', $tes->id)->first();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function generateAndStore(Tes $tes): bool
|
||||||
|
{
|
||||||
|
$tes->loadMissing('penyakit');
|
||||||
|
|
||||||
|
$hasilList = HasilSaw::where('tes_id', $tes->id)
|
||||||
|
->with('jurusan')
|
||||||
|
->orderBy('peringkat')
|
||||||
|
->get();
|
||||||
|
|
||||||
|
$siswa = $tes->siswa()->with('user')->first();
|
||||||
|
|
||||||
|
$html = view('pages.siswa.hasil-pdf', [
|
||||||
|
'siswa' => $siswa,
|
||||||
|
'tesTerakhir' => $tes,
|
||||||
|
'hasilList' => $hasilList,
|
||||||
|
])->render();
|
||||||
|
|
||||||
|
$fileName = 'hasil_tes_' . $tes->id . '.pdf';
|
||||||
|
$relativePath = 'hasil_pdf/' . $fileName;
|
||||||
|
|
||||||
|
try {
|
||||||
|
$binary = Pdf::loadHTML($html)
|
||||||
|
->setPaper('a4')
|
||||||
|
->output();
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
Log::error('DomPDF gagal generate PDF hasil tes', [
|
||||||
|
'tes_id' => $tes->id,
|
||||||
|
'message' => $e->getMessage(),
|
||||||
|
]);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Storage::disk('public')->put($relativePath, $binary);
|
||||||
|
|
||||||
|
$uploadData = [
|
||||||
|
'uploader_user_id' => $siswa?->user_id,
|
||||||
|
'file_name' => $fileName,
|
||||||
|
'ext' => 'PDF',
|
||||||
|
'mime_type' => 'application/pdf',
|
||||||
|
'size_mb' => round(strlen($binary) / 1048576, 2),
|
||||||
|
'storage_path' => $relativePath,
|
||||||
|
];
|
||||||
|
|
||||||
|
$tesPdf = TesPdf::with('upload')->where('tes_id', $tes->id)->first();
|
||||||
|
|
||||||
|
if ($tesPdf?->upload) {
|
||||||
|
$tesPdf->upload->update($uploadData);
|
||||||
|
$upload = $tesPdf->upload->fresh();
|
||||||
|
} else {
|
||||||
|
$upload = Upload::create($uploadData);
|
||||||
|
}
|
||||||
|
|
||||||
|
TesPdf::updateOrCreate(
|
||||||
|
['tes_id' => $tes->id],
|
||||||
|
['upload_id' => $upload->id, 'generated_at' => now()]
|
||||||
|
);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\View\Components;
|
||||||
|
|
||||||
|
use Illuminate\View\Component;
|
||||||
|
use Illuminate\View\View;
|
||||||
|
|
||||||
|
class AppLayout extends Component
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the view / contents that represents the component.
|
||||||
|
*/
|
||||||
|
public function render(): View
|
||||||
|
{
|
||||||
|
return view('layouts.app');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\View\Components;
|
||||||
|
|
||||||
|
use Illuminate\View\Component;
|
||||||
|
use Illuminate\View\View;
|
||||||
|
|
||||||
|
class GuestLayout extends Component
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the view / contents that represents the component.
|
||||||
|
*/
|
||||||
|
public function render(): View
|
||||||
|
{
|
||||||
|
return view('layouts.guest');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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);
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
<?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): void {
|
||||||
|
$middleware->alias([
|
||||||
|
'force.password.change' => \App\Http\Middleware\ForcePasswordChange::class,
|
||||||
|
]);
|
||||||
|
})
|
||||||
|
->withExceptions(function (Exceptions $exceptions): void {
|
||||||
|
//
|
||||||
|
})->create();
|
||||||
|
|
@ -0,0 +1,70 @@
|
||||||
|
<?php return array (
|
||||||
|
'barryvdh/laravel-dompdf' =>
|
||||||
|
array (
|
||||||
|
'aliases' =>
|
||||||
|
array (
|
||||||
|
'PDF' => 'Barryvdh\\DomPDF\\Facade\\Pdf',
|
||||||
|
'Pdf' => 'Barryvdh\\DomPDF\\Facade\\Pdf',
|
||||||
|
),
|
||||||
|
'providers' =>
|
||||||
|
array (
|
||||||
|
0 => 'Barryvdh\\DomPDF\\ServiceProvider',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'laravel/breeze' =>
|
||||||
|
array (
|
||||||
|
'providers' =>
|
||||||
|
array (
|
||||||
|
0 => 'Laravel\\Breeze\\BreezeServiceProvider',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'laravel/pail' =>
|
||||||
|
array (
|
||||||
|
'providers' =>
|
||||||
|
array (
|
||||||
|
0 => 'Laravel\\Pail\\PailServiceProvider',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'laravel/sail' =>
|
||||||
|
array (
|
||||||
|
'providers' =>
|
||||||
|
array (
|
||||||
|
0 => 'Laravel\\Sail\\SailServiceProvider',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'laravel/tinker' =>
|
||||||
|
array (
|
||||||
|
'providers' =>
|
||||||
|
array (
|
||||||
|
0 => 'Laravel\\Tinker\\TinkerServiceProvider',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'nesbot/carbon' =>
|
||||||
|
array (
|
||||||
|
'providers' =>
|
||||||
|
array (
|
||||||
|
0 => 'Carbon\\Laravel\\ServiceProvider',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'nunomaduro/collision' =>
|
||||||
|
array (
|
||||||
|
'providers' =>
|
||||||
|
array (
|
||||||
|
0 => 'NunoMaduro\\Collision\\Adapters\\Laravel\\CollisionServiceProvider',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'nunomaduro/termwind' =>
|
||||||
|
array (
|
||||||
|
'providers' =>
|
||||||
|
array (
|
||||||
|
0 => 'Termwind\\Laravel\\TermwindServiceProvider',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'pestphp/pest-plugin-laravel' =>
|
||||||
|
array (
|
||||||
|
'providers' =>
|
||||||
|
array (
|
||||||
|
0 => 'Pest\\Laravel\\PestServiceProvider',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
@ -0,0 +1,270 @@
|
||||||
|
<?php return array (
|
||||||
|
'providers' =>
|
||||||
|
array (
|
||||||
|
0 => 'Illuminate\\Auth\\AuthServiceProvider',
|
||||||
|
1 => 'Illuminate\\Broadcasting\\BroadcastServiceProvider',
|
||||||
|
2 => 'Illuminate\\Bus\\BusServiceProvider',
|
||||||
|
3 => 'Illuminate\\Cache\\CacheServiceProvider',
|
||||||
|
4 => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
5 => 'Illuminate\\Concurrency\\ConcurrencyServiceProvider',
|
||||||
|
6 => 'Illuminate\\Cookie\\CookieServiceProvider',
|
||||||
|
7 => 'Illuminate\\Database\\DatabaseServiceProvider',
|
||||||
|
8 => 'Illuminate\\Encryption\\EncryptionServiceProvider',
|
||||||
|
9 => 'Illuminate\\Filesystem\\FilesystemServiceProvider',
|
||||||
|
10 => 'Illuminate\\Foundation\\Providers\\FoundationServiceProvider',
|
||||||
|
11 => 'Illuminate\\Hashing\\HashServiceProvider',
|
||||||
|
12 => 'Illuminate\\Mail\\MailServiceProvider',
|
||||||
|
13 => 'Illuminate\\Notifications\\NotificationServiceProvider',
|
||||||
|
14 => 'Illuminate\\Pagination\\PaginationServiceProvider',
|
||||||
|
15 => 'Illuminate\\Auth\\Passwords\\PasswordResetServiceProvider',
|
||||||
|
16 => 'Illuminate\\Pipeline\\PipelineServiceProvider',
|
||||||
|
17 => 'Illuminate\\Queue\\QueueServiceProvider',
|
||||||
|
18 => 'Illuminate\\Redis\\RedisServiceProvider',
|
||||||
|
19 => 'Illuminate\\Session\\SessionServiceProvider',
|
||||||
|
20 => 'Illuminate\\Translation\\TranslationServiceProvider',
|
||||||
|
21 => 'Illuminate\\Validation\\ValidationServiceProvider',
|
||||||
|
22 => 'Illuminate\\View\\ViewServiceProvider',
|
||||||
|
23 => 'Barryvdh\\DomPDF\\ServiceProvider',
|
||||||
|
24 => 'Laravel\\Breeze\\BreezeServiceProvider',
|
||||||
|
25 => 'Laravel\\Pail\\PailServiceProvider',
|
||||||
|
26 => 'Laravel\\Sail\\SailServiceProvider',
|
||||||
|
27 => 'Laravel\\Tinker\\TinkerServiceProvider',
|
||||||
|
28 => 'Carbon\\Laravel\\ServiceProvider',
|
||||||
|
29 => 'NunoMaduro\\Collision\\Adapters\\Laravel\\CollisionServiceProvider',
|
||||||
|
30 => 'Termwind\\Laravel\\TermwindServiceProvider',
|
||||||
|
31 => 'Pest\\Laravel\\PestServiceProvider',
|
||||||
|
32 => 'App\\Providers\\AppServiceProvider',
|
||||||
|
),
|
||||||
|
'eager' =>
|
||||||
|
array (
|
||||||
|
0 => 'Illuminate\\Auth\\AuthServiceProvider',
|
||||||
|
1 => 'Illuminate\\Cookie\\CookieServiceProvider',
|
||||||
|
2 => 'Illuminate\\Database\\DatabaseServiceProvider',
|
||||||
|
3 => 'Illuminate\\Encryption\\EncryptionServiceProvider',
|
||||||
|
4 => 'Illuminate\\Filesystem\\FilesystemServiceProvider',
|
||||||
|
5 => 'Illuminate\\Foundation\\Providers\\FoundationServiceProvider',
|
||||||
|
6 => 'Illuminate\\Notifications\\NotificationServiceProvider',
|
||||||
|
7 => 'Illuminate\\Pagination\\PaginationServiceProvider',
|
||||||
|
8 => 'Illuminate\\Session\\SessionServiceProvider',
|
||||||
|
9 => 'Illuminate\\View\\ViewServiceProvider',
|
||||||
|
10 => 'Barryvdh\\DomPDF\\ServiceProvider',
|
||||||
|
11 => 'Laravel\\Pail\\PailServiceProvider',
|
||||||
|
12 => 'Carbon\\Laravel\\ServiceProvider',
|
||||||
|
13 => 'NunoMaduro\\Collision\\Adapters\\Laravel\\CollisionServiceProvider',
|
||||||
|
14 => 'Termwind\\Laravel\\TermwindServiceProvider',
|
||||||
|
15 => 'Pest\\Laravel\\PestServiceProvider',
|
||||||
|
16 => 'App\\Providers\\AppServiceProvider',
|
||||||
|
),
|
||||||
|
'deferred' =>
|
||||||
|
array (
|
||||||
|
'Illuminate\\Broadcasting\\BroadcastManager' => 'Illuminate\\Broadcasting\\BroadcastServiceProvider',
|
||||||
|
'Illuminate\\Contracts\\Broadcasting\\Factory' => 'Illuminate\\Broadcasting\\BroadcastServiceProvider',
|
||||||
|
'Illuminate\\Contracts\\Broadcasting\\Broadcaster' => 'Illuminate\\Broadcasting\\BroadcastServiceProvider',
|
||||||
|
'Illuminate\\Bus\\Dispatcher' => 'Illuminate\\Bus\\BusServiceProvider',
|
||||||
|
'Illuminate\\Contracts\\Bus\\Dispatcher' => 'Illuminate\\Bus\\BusServiceProvider',
|
||||||
|
'Illuminate\\Contracts\\Bus\\QueueingDispatcher' => 'Illuminate\\Bus\\BusServiceProvider',
|
||||||
|
'Illuminate\\Bus\\BatchRepository' => 'Illuminate\\Bus\\BusServiceProvider',
|
||||||
|
'Illuminate\\Bus\\DatabaseBatchRepository' => 'Illuminate\\Bus\\BusServiceProvider',
|
||||||
|
'cache' => 'Illuminate\\Cache\\CacheServiceProvider',
|
||||||
|
'cache.store' => 'Illuminate\\Cache\\CacheServiceProvider',
|
||||||
|
'cache.psr6' => 'Illuminate\\Cache\\CacheServiceProvider',
|
||||||
|
'memcached.connector' => 'Illuminate\\Cache\\CacheServiceProvider',
|
||||||
|
'Illuminate\\Cache\\RateLimiter' => 'Illuminate\\Cache\\CacheServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\AboutCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Cache\\Console\\ClearCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Cache\\Console\\ForgetCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\ClearCompiledCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Auth\\Console\\ClearResetsCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\ConfigCacheCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\ConfigClearCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\ConfigShowCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Database\\Console\\DbCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Database\\Console\\MonitorCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Database\\Console\\PruneCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Database\\Console\\ShowCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Database\\Console\\TableCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Database\\Console\\WipeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\DownCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\EnvironmentCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\EnvironmentDecryptCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\EnvironmentEncryptCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\EventCacheCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\EventClearCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\EventListCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Concurrency\\Console\\InvokeSerializedClosureCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\KeyGenerateCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\OptimizeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\OptimizeClearCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\PackageDiscoverCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Cache\\Console\\PruneStaleTagsCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Queue\\Console\\ClearCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Queue\\Console\\ListFailedCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Queue\\Console\\FlushFailedCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Queue\\Console\\ForgetFailedCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Queue\\Console\\ListenCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Queue\\Console\\MonitorCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Queue\\Console\\PauseCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Queue\\Console\\PruneBatchesCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Queue\\Console\\PruneFailedJobsCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Queue\\Console\\RestartCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Queue\\Console\\ResumeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Queue\\Console\\RetryCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Queue\\Console\\RetryBatchCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Queue\\Console\\WorkCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\ReloadCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\RouteCacheCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\RouteClearCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\RouteListCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Database\\Console\\DumpCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Database\\Console\\Seeds\\SeedCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Console\\Scheduling\\ScheduleFinishCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Console\\Scheduling\\ScheduleListCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Console\\Scheduling\\ScheduleRunCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Console\\Scheduling\\ScheduleClearCacheCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Console\\Scheduling\\ScheduleTestCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Console\\Scheduling\\ScheduleWorkCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Console\\Scheduling\\ScheduleInterruptCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Database\\Console\\ShowModelCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\StorageLinkCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\StorageUnlinkCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\UpCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\ViewCacheCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\ViewClearCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\ApiInstallCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\BroadcastingInstallCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Cache\\Console\\CacheTableCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\CastMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\ChannelListCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\ChannelMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\ClassMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\ComponentMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\ConfigMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\ConfigPublishCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\ConsoleMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Routing\\Console\\ControllerMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\DocsCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\EnumMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\EventGenerateCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\EventMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\ExceptionMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Database\\Console\\Factories\\FactoryMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\InterfaceMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\JobMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\JobMiddlewareMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\LangPublishCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\ListenerMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\MailMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Routing\\Console\\MiddlewareMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\ModelMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\NotificationMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Notifications\\Console\\NotificationTableCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\ObserverMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\PolicyMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\ProviderMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Queue\\Console\\FailedTableCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Queue\\Console\\TableCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Queue\\Console\\BatchesTableCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\RequestMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\ResourceMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\RuleMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\ScopeMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Database\\Console\\Seeds\\SeederMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Session\\Console\\SessionTableCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\ServeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\StubPublishCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\TestMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\TraitMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\VendorPublishCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Foundation\\Console\\ViewMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'migrator' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'migration.repository' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'migration.creator' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Database\\Migrations\\Migrator' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Database\\Console\\Migrations\\MigrateCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Database\\Console\\Migrations\\FreshCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Database\\Console\\Migrations\\InstallCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Database\\Console\\Migrations\\RefreshCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Database\\Console\\Migrations\\ResetCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Database\\Console\\Migrations\\RollbackCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Database\\Console\\Migrations\\StatusCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Database\\Console\\Migrations\\MigrateMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'composer' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Concurrency\\ConcurrencyManager' => 'Illuminate\\Concurrency\\ConcurrencyServiceProvider',
|
||||||
|
'hash' => 'Illuminate\\Hashing\\HashServiceProvider',
|
||||||
|
'hash.driver' => 'Illuminate\\Hashing\\HashServiceProvider',
|
||||||
|
'mail.manager' => 'Illuminate\\Mail\\MailServiceProvider',
|
||||||
|
'mailer' => 'Illuminate\\Mail\\MailServiceProvider',
|
||||||
|
'Illuminate\\Mail\\Markdown' => 'Illuminate\\Mail\\MailServiceProvider',
|
||||||
|
'auth.password' => 'Illuminate\\Auth\\Passwords\\PasswordResetServiceProvider',
|
||||||
|
'auth.password.broker' => 'Illuminate\\Auth\\Passwords\\PasswordResetServiceProvider',
|
||||||
|
'Illuminate\\Contracts\\Pipeline\\Hub' => 'Illuminate\\Pipeline\\PipelineServiceProvider',
|
||||||
|
'pipeline' => 'Illuminate\\Pipeline\\PipelineServiceProvider',
|
||||||
|
'queue' => 'Illuminate\\Queue\\QueueServiceProvider',
|
||||||
|
'queue.connection' => 'Illuminate\\Queue\\QueueServiceProvider',
|
||||||
|
'queue.failer' => 'Illuminate\\Queue\\QueueServiceProvider',
|
||||||
|
'queue.listener' => 'Illuminate\\Queue\\QueueServiceProvider',
|
||||||
|
'queue.worker' => 'Illuminate\\Queue\\QueueServiceProvider',
|
||||||
|
'redis' => 'Illuminate\\Redis\\RedisServiceProvider',
|
||||||
|
'redis.connection' => 'Illuminate\\Redis\\RedisServiceProvider',
|
||||||
|
'translator' => 'Illuminate\\Translation\\TranslationServiceProvider',
|
||||||
|
'translation.loader' => 'Illuminate\\Translation\\TranslationServiceProvider',
|
||||||
|
'validator' => 'Illuminate\\Validation\\ValidationServiceProvider',
|
||||||
|
'validation.presence' => 'Illuminate\\Validation\\ValidationServiceProvider',
|
||||||
|
'Illuminate\\Contracts\\Validation\\UncompromisedVerifier' => 'Illuminate\\Validation\\ValidationServiceProvider',
|
||||||
|
'Laravel\\Breeze\\Console\\InstallCommand' => 'Laravel\\Breeze\\BreezeServiceProvider',
|
||||||
|
'Laravel\\Sail\\Console\\InstallCommand' => 'Laravel\\Sail\\SailServiceProvider',
|
||||||
|
'Laravel\\Sail\\Console\\PublishCommand' => 'Laravel\\Sail\\SailServiceProvider',
|
||||||
|
'command.tinker' => 'Laravel\\Tinker\\TinkerServiceProvider',
|
||||||
|
),
|
||||||
|
'when' =>
|
||||||
|
array (
|
||||||
|
'Illuminate\\Broadcasting\\BroadcastServiceProvider' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'Illuminate\\Bus\\BusServiceProvider' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'Illuminate\\Cache\\CacheServiceProvider' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'Illuminate\\Concurrency\\ConcurrencyServiceProvider' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'Illuminate\\Hashing\\HashServiceProvider' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'Illuminate\\Mail\\MailServiceProvider' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'Illuminate\\Auth\\Passwords\\PasswordResetServiceProvider' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'Illuminate\\Pipeline\\PipelineServiceProvider' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'Illuminate\\Queue\\QueueServiceProvider' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'Illuminate\\Redis\\RedisServiceProvider' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'Illuminate\\Translation\\TranslationServiceProvider' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'Illuminate\\Validation\\ValidationServiceProvider' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'Laravel\\Breeze\\BreezeServiceProvider' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'Laravel\\Sail\\SailServiceProvider' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'Laravel\\Tinker\\TinkerServiceProvider' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
App\Providers\AppServiceProvider::class,
|
||||||
|
];
|
||||||
|
|
@ -0,0 +1,90 @@
|
||||||
|
{
|
||||||
|
"$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/tinker": "^2.10.1",
|
||||||
|
"spatie/browsershot": "^5.2"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"fakerphp/faker": "^1.23",
|
||||||
|
"laravel/breeze": "^2.3",
|
||||||
|
"laravel/pail": "^1.2.2",
|
||||||
|
"laravel/pint": "^1.24",
|
||||||
|
"laravel/sail": "^1.41",
|
||||||
|
"mockery/mockery": "^1.6",
|
||||||
|
"nunomaduro/collision": "^8.6",
|
||||||
|
"pestphp/pest": "^4.3",
|
||||||
|
"pestphp/pest-plugin-laravel": "^4.0"
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"App\\": "app/",
|
||||||
|
"Database\\Factories\\": "database/factories/",
|
||||||
|
"Database\\Seeders\\": "database/seeders/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload-dev": {
|
||||||
|
"psr-4": {
|
||||||
|
"Tests\\": "tests/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"setup": [
|
||||||
|
"composer install",
|
||||||
|
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\"",
|
||||||
|
"@php artisan key:generate",
|
||||||
|
"@php artisan migrate --force",
|
||||||
|
"npm install",
|
||||||
|
"npm run build"
|
||||||
|
],
|
||||||
|
"dev": [
|
||||||
|
"Composer\\Config::disableProcessTimeout",
|
||||||
|
"npx concurrently -c \"#93c5fd,#c4b5fd,#fb7185,#fdba74\" \"php artisan serve\" \"php artisan queue:listen --tries=1 --timeout=0\" \"php artisan pail --timeout=0\" \"npm run dev\" --names=server,queue,logs,vite --kill-others"
|
||||||
|
],
|
||||||
|
"test": [
|
||||||
|
"@php artisan config:clear --ansi",
|
||||||
|
"@php artisan test"
|
||||||
|
],
|
||||||
|
"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"
|
||||||
|
],
|
||||||
|
"pre-package-uninstall": [
|
||||||
|
"Illuminate\\Foundation\\ComposerScripts::prePackageUninstall"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"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
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -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' => 'asia/jakarta',
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| 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(',', (string) 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'),
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
||||||
|
|
@ -0,0 +1,45 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
'defaults' => [
|
||||||
|
'guard' => 'web',
|
||||||
|
'passwords' => 'users',
|
||||||
|
],
|
||||||
|
|
||||||
|
'guards' => [
|
||||||
|
'web' => [
|
||||||
|
'driver' => 'session',
|
||||||
|
'provider' => 'users',
|
||||||
|
],
|
||||||
|
|
||||||
|
'siswa' => [
|
||||||
|
'driver' => 'session',
|
||||||
|
'provider' => 'siswa',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
'providers' => [
|
||||||
|
'users' => [
|
||||||
|
'driver' => 'eloquent',
|
||||||
|
'model' => App\Models\User::class,
|
||||||
|
],
|
||||||
|
|
||||||
|
'siswa' => [
|
||||||
|
'driver' => 'eloquent',
|
||||||
|
'model' => App\Models\Siswa::class,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
'passwords' => [
|
||||||
|
'users' => [
|
||||||
|
'provider' => 'users',
|
||||||
|
'table' => 'password_reset_tokens',
|
||||||
|
'expire' => 60,
|
||||||
|
'throttle' => 60,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
'password_timeout' => 10800,
|
||||||
|
|
||||||
|
];
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'chrome_path' => env('BROWSERSHOT_CHROME_PATH', null),
|
||||||
|
];
|
||||||
|
|
@ -0,0 +1,117 @@
|
||||||
|
<?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",
|
||||||
|
| "failover", "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',
|
||||||
|
],
|
||||||
|
|
||||||
|
'failover' => [
|
||||||
|
'driver' => 'failover',
|
||||||
|
'stores' => [
|
||||||
|
'database',
|
||||||
|
'array',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| 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((string) env('APP_NAME', 'laravel')).'-cache-'),
|
||||||
|
|
||||||
|
];
|
||||||
|
|
@ -0,0 +1,183 @@
|
||||||
|
<?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,
|
||||||
|
'transaction_mode' => 'DEFERRED',
|
||||||
|
],
|
||||||
|
|
||||||
|
'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([
|
||||||
|
(PHP_VERSION_ID >= 80500 ? \Pdo\Mysql::ATTR_SSL_CA : \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([
|
||||||
|
(PHP_VERSION_ID >= 80500 ? \Pdo\Mysql::ATTR_SSL_CA : \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' => env('DB_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((string) 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'),
|
||||||
|
'max_retries' => env('REDIS_MAX_RETRIES', 3),
|
||||||
|
'backoff_algorithm' => env('REDIS_BACKOFF_ALGORITHM', 'decorrelated_jitter'),
|
||||||
|
'backoff_base' => env('REDIS_BACKOFF_BASE', 100),
|
||||||
|
'backoff_cap' => env('REDIS_BACKOFF_CAP', 1000),
|
||||||
|
],
|
||||||
|
|
||||||
|
'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'),
|
||||||
|
'max_retries' => env('REDIS_MAX_RETRIES', 3),
|
||||||
|
'backoff_algorithm' => env('REDIS_BACKOFF_ALGORITHM', 'decorrelated_jitter'),
|
||||||
|
'backoff_base' => env('REDIS_BACKOFF_BASE', 100),
|
||||||
|
'backoff_cap' => env('REDIS_BACKOFF_CAP', 1000),
|
||||||
|
],
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
||||||
|
|
@ -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' => rtrim(env('APP_URL', 'http://localhost'), '/').'/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'),
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
||||||
|
|
@ -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(',', (string) 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,
|
||||||
|
'handler_with' => [
|
||||||
|
'stream' => 'php://stderr',
|
||||||
|
],
|
||||||
|
'formatter' => env('LOG_STDERR_FORMATTER'),
|
||||||
|
'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'),
|
||||||
|
],
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
||||||
|
|
@ -0,0 +1,118 @@
|
||||||
|
<?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((string) 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',
|
||||||
|
],
|
||||||
|
'retry_after' => 60,
|
||||||
|
],
|
||||||
|
|
||||||
|
'roundrobin' => [
|
||||||
|
'transport' => 'roundrobin',
|
||||||
|
'mailers' => [
|
||||||
|
'ses',
|
||||||
|
'postmark',
|
||||||
|
],
|
||||||
|
'retry_after' => 60,
|
||||||
|
],
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| 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'),
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
||||||
|
|
@ -0,0 +1,129 @@
|
||||||
|
<?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",
|
||||||
|
| "deferred", "background", "failover", "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,
|
||||||
|
],
|
||||||
|
|
||||||
|
'deferred' => [
|
||||||
|
'driver' => 'deferred',
|
||||||
|
],
|
||||||
|
|
||||||
|
'background' => [
|
||||||
|
'driver' => 'background',
|
||||||
|
],
|
||||||
|
|
||||||
|
'failover' => [
|
||||||
|
'driver' => 'failover',
|
||||||
|
'connections' => [
|
||||||
|
'database',
|
||||||
|
'deferred',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| 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',
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
||||||
|
|
@ -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' => [
|
||||||
|
'key' => env('POSTMARK_API_KEY'),
|
||||||
|
],
|
||||||
|
|
||||||
|
'resend' => [
|
||||||
|
'key' => env('RESEND_API_KEY'),
|
||||||
|
],
|
||||||
|
|
||||||
|
'ses' => [
|
||||||
|
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||||
|
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||||
|
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||||
|
],
|
||||||
|
|
||||||
|
'slack' => [
|
||||||
|
'notifications' => [
|
||||||
|
'bot_user_oauth_token' => env('SLACK_BOT_USER_OAUTH_TOKEN'),
|
||||||
|
'channel' => env('SLACK_BOT_USER_DEFAULT_CHANNEL'),
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
||||||
|
|
@ -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", "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: "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((string) 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 without 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),
|
||||||
|
|
||||||
|
];
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
*.sqlite*
|
||||||
|
|
@ -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 [
|
||||||
|
'name' => fake()->name(),
|
||||||
|
'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,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('roles', function (Blueprint $table) {
|
||||||
|
$table->id(); // WAJIB ada 'id' karena users.role_id constrained ke roles.id
|
||||||
|
$table->string('nama_role', 30)->unique();
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
|
||||||
|
$now = now();
|
||||||
|
|
||||||
|
DB::table('roles')->insert([
|
||||||
|
['nama_role' => 'admin', 'created_at' => $now, 'updated_at' => $now],
|
||||||
|
['nama_role' => 'guru_bk', 'created_at' => $now, 'updated_at' => $now],
|
||||||
|
['nama_role' => 'siswa', 'created_at' => $now, 'updated_at' => $now],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('roles');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('users', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->foreignId('role_id')->constrained('roles');
|
||||||
|
$table->string('nama', 120);
|
||||||
|
$table->string('email', 191)->unique();
|
||||||
|
$table->string('password_hash');
|
||||||
|
$table->boolean('is_active')->default(true);
|
||||||
|
$table->boolean('must_change_password')->default(false);
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('users');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?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('jurusan', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->string('nama_jurusan', 150)->unique();
|
||||||
|
$table->boolean('is_active')->default(true);
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('jurusan');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
<?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('siswa', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->foreignId('user_id')->unique()->constrained('users')->cascadeOnDelete();
|
||||||
|
$table->string('sekolah_asal', 150);
|
||||||
|
$table->enum('jenis_kelamin', ['L', 'P']);
|
||||||
|
$table->string('no_telepon', 30);
|
||||||
|
$table->text('alamat');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('siswa');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -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('guru_bk', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->foreignId('user_id')->unique()->constrained('users')->cascadeOnDelete();
|
||||||
|
$table->string('nip', 50);
|
||||||
|
$table->foreignId('jurusan_id')->nullable()->constrained('jurusan');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('guru_bk');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?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('admin', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->foreignId('user_id')->unique()->constrained('users')->cascadeOnDelete();
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('admin');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?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('password_resets', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->foreignId('user_id')->constrained('users')->cascadeOnDelete();
|
||||||
|
$table->string('otp_code', 255);
|
||||||
|
$table->dateTime('expires_at');
|
||||||
|
$table->boolean('is_used')->default(false);
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('password_resets');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?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('soal_minat', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->text('pertanyaan');
|
||||||
|
$table->boolean('is_active')->default(true);
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('soal_minat');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
<?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('tes', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->foreignId('siswa_id')->constrained('siswa')->cascadeOnDelete();
|
||||||
|
|
||||||
|
// Nilai mata pelajaran dipisah
|
||||||
|
$table->decimal('nilai_matematika', 5, 2);
|
||||||
|
$table->decimal('nilai_bahasa_indonesia', 5, 2);
|
||||||
|
$table->decimal('nilai_bahasa_inggris', 5, 2);
|
||||||
|
$table->decimal('nilai_ipa', 5, 2);
|
||||||
|
|
||||||
|
$table->tinyInteger('skor_minat_bakat');
|
||||||
|
$table->decimal('tinggi_badan', 6, 2);
|
||||||
|
$table->decimal('berat_badan', 6, 2);
|
||||||
|
$table->boolean('buta_warna');
|
||||||
|
|
||||||
|
$table->foreignId('minat_jurusan_1_id')->nullable()->constrained('jurusan');
|
||||||
|
$table->foreignId('minat_jurusan_2_id')->nullable()->constrained('jurusan');
|
||||||
|
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('tes');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -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('jawaban_minat', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->foreignId('tes_id')->constrained('tes')->cascadeOnDelete();
|
||||||
|
$table->foreignId('soal_minat_id')->constrained('soal_minat')->cascadeOnDelete();
|
||||||
|
$table->tinyInteger('skor');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('jawaban_minat');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
<?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('hasil_saw', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->foreignId('tes_id')->constrained('tes')->cascadeOnDelete();
|
||||||
|
$table->foreignId('jurusan_id')->constrained('jurusan');
|
||||||
|
$table->decimal('nilai_preferensi', 12, 6);
|
||||||
|
$table->integer('peringkat');
|
||||||
|
$table->timestamps();
|
||||||
|
|
||||||
|
$table->unique(['tes_id', 'jurusan_id']);
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('hasil_saw');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
<?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('uploads', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->foreignId('uploader_user_id')->constrained('users');
|
||||||
|
$table->string('file_name');
|
||||||
|
$table->enum('ext', ['MP4', 'JPG', 'PDF']);
|
||||||
|
$table->string('mime_type', 100);
|
||||||
|
$table->decimal('size_mb', 8, 2);
|
||||||
|
$table->string('storage_path', 500);
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('uploads');
|
||||||
|
}
|
||||||
|
};
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue