first commit

This commit is contained in:
KarismaAgustiningtyas 2024-06-27 10:56:30 +07:00
parent 496507432c
commit 5e8b9dabf3
6357 changed files with 549635 additions and 0 deletions

18
.editorconfig Normal file
View File

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

11
.gitattributes vendored Normal file
View File

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

19
.gitignore vendored Normal file
View File

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

View File

@ -0,0 +1,35 @@
<?php
namespace App\Actions\Fortify;
use App\Models\User;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
use Laravel\Fortify\Contracts\CreatesNewUsers;
use Laravel\Jetstream\Jetstream;
class CreateNewUser implements CreatesNewUsers
{
use PasswordValidationRules;
/**
* Validate and create a newly registered user.
*
* @param array<string, string> $input
*/
public function create(array $input): User
{
Validator::make($input, [
'name' => ['required', 'string', 'max:255'],
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
'password' => $this->passwordRules(),
'terms' => Jetstream::hasTermsAndPrivacyPolicyFeature() ? ['accepted', 'required'] : '',
])->validate();
return User::create([
'name' => $input['name'],
'email' => $input['email'],
'password' => Hash::make($input['password']),
]);
}
}

View File

@ -0,0 +1,18 @@
<?php
namespace App\Actions\Fortify;
use Laravel\Fortify\Rules\Password;
trait PasswordValidationRules
{
/**
* Get the validation rules used to validate passwords.
*
* @return array<int, \Illuminate\Contracts\Validation\Rule|array|string>
*/
protected function passwordRules(): array
{
return ['required', 'string', new Password, 'confirmed'];
}
}

View File

@ -0,0 +1,29 @@
<?php
namespace App\Actions\Fortify;
use App\Models\User;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
use Laravel\Fortify\Contracts\ResetsUserPasswords;
class ResetUserPassword implements ResetsUserPasswords
{
use PasswordValidationRules;
/**
* Validate and reset the user's forgotten password.
*
* @param array<string, string> $input
*/
public function reset(User $user, array $input): void
{
Validator::make($input, [
'password' => $this->passwordRules(),
])->validate();
$user->forceFill([
'password' => Hash::make($input['password']),
])->save();
}
}

View File

@ -0,0 +1,32 @@
<?php
namespace App\Actions\Fortify;
use App\Models\User;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
use Laravel\Fortify\Contracts\UpdatesUserPasswords;
class UpdateUserPassword implements UpdatesUserPasswords
{
use PasswordValidationRules;
/**
* Validate and update the user's password.
*
* @param array<string, string> $input
*/
public function update(User $user, array $input): void
{
Validator::make($input, [
'current_password' => ['required', 'string', 'current_password:web'],
'password' => $this->passwordRules(),
], [
'current_password.current_password' => __('The provided password does not match your current password.'),
])->validateWithBag('updatePassword');
$user->forceFill([
'password' => Hash::make($input['password']),
])->save();
}
}

View File

@ -0,0 +1,56 @@
<?php
namespace App\Actions\Fortify;
use App\Models\User;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Support\Facades\Validator;
use Illuminate\Validation\Rule;
use Laravel\Fortify\Contracts\UpdatesUserProfileInformation;
class UpdateUserProfileInformation implements UpdatesUserProfileInformation
{
/**
* Validate and update the given user's profile information.
*
* @param array<string, string> $input
*/
public function update(User $user, array $input): void
{
Validator::make($input, [
'name' => ['required', 'string', 'max:255'],
'email' => ['required', 'email', 'max:255', Rule::unique('users')->ignore($user->id)],
'photo' => ['nullable', 'mimes:jpg,jpeg,png', 'max:1024'],
])->validateWithBag('updateProfileInformation');
if (isset($input['photo'])) {
$user->updateProfilePhoto($input['photo']);
}
if ($input['email'] !== $user->email &&
$user instanceof MustVerifyEmail) {
$this->updateVerifiedUser($user, $input);
} else {
$user->forceFill([
'name' => $input['name'],
'email' => $input['email'],
])->save();
}
}
/**
* Update the given verified user's profile information.
*
* @param array<string, string> $input
*/
protected function updateVerifiedUser(User $user, array $input): void
{
$user->forceFill([
'name' => $input['name'],
'email' => $input['email'],
'email_verified_at' => null,
])->save();
$user->sendEmailVerificationNotification();
}
}

View File

@ -0,0 +1,19 @@
<?php
namespace App\Actions\Jetstream;
use App\Models\User;
use Laravel\Jetstream\Contracts\DeletesUsers;
class DeleteUser implements DeletesUsers
{
/**
* Delete the given user.
*/
public function delete(User $user): void
{
$user->deleteProfilePhoto();
$user->tokens->each->delete();
$user->delete();
}
}

27
app/Console/Kernel.php Normal file
View File

@ -0,0 +1,27 @@
<?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* Define the application's command schedule.
*/
protected function schedule(Schedule $schedule): void
{
// $schedule->command('inspire')->hourly();
}
/**
* Register the commands for the application.
*/
protected function commands(): void
{
$this->load(__DIR__.'/Commands');
require base_path('routes/console.php');
}
}

View File

@ -0,0 +1,30 @@
<?php
namespace App\Exceptions;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Throwable;
class Handler extends ExceptionHandler
{
/**
* The list of the inputs that are never flashed to the session on validation exceptions.
*
* @var array<int, string>
*/
protected $dontFlash = [
'current_password',
'password',
'password_confirmation',
];
/**
* Register the exception handling callbacks for the application.
*/
public function register(): void
{
$this->reportable(function (Throwable $e) {
//
});
}
}

View File

@ -0,0 +1,59 @@
<?php
namespace App\Exports;
use Carbon\Carbon;
use App\Models\SeminarJadwal;
use Maatwebsite\Excel\Concerns\WithMapping;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\FromCollection;
class SeminarProposalExport implements FromCollection, WithHeadings, WithMapping
{
public function collection()
{
// Pastikan untuk memuat relasi yang diperlukan
return SeminarJadwal::with([
'pengajuan',
'mahasiswa',
'dosenPembimbing',
'dosenPanelis1',
'seminarProposal',
'seminarProposalWaktu',
'seminarProposalTempat'
])->get();
}
public function headings(): array
{
return [
'Tanggal',
'Waktu',
'Tempat',
'Nama Mahasiswa',
'Dosen Pembimbing',
'Dosen Penguji',
];
}
public function map($seminarJadwal): array
{
// Format tanggal
$tanggal = Carbon::parse($seminarJadwal->tanggal_seminar)->format('d-m-Y');
// Gabungkan waktu mulai dan selesai
$waktu = '';
if ($seminarJadwal->seminarProposalWaktu) {
$waktu = Carbon::parse($seminarJadwal->seminarProposalWaktu->waktu_mulai)->format('H:i') . ' - ' . Carbon::parse($seminarJadwal->seminarProposalWaktu->waktu_selesai)->format('H:i');
}
return [
$tanggal,
$waktu,
$seminarJadwal->seminarProposalTempat->ruang,
$seminarJadwal->mahasiswa->name,
$seminarJadwal->dosenPembimbing->name,
$seminarJadwal->dosenPanelis1->name,
];
}
}

View File

@ -0,0 +1,63 @@
<?php
namespace App\Exports;
use Carbon\Carbon;
use App\Models\SidangJadwal;
use Maatwebsite\Excel\Concerns\WithMapping;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\FromCollection;
class SidangExport implements FromCollection, WithHeadings, WithMapping
{
public function collection()
{
// Pastikan untuk memuat relasi yang diperlukan
return SidangJadwal::with([
'pengajuan',
'mahasiswa',
'dosenPembimbing',
'dosenPanelis1',
'dosenPanelis2',
'seminarProposal',
'sidang',
'sidangWaktu',
'sidangTempat'
])->get();
}
public function headings(): array
{
return [
'Tanggal',
'Waktu',
'Tempat',
'Nama Mahasiswa',
'Ketua Penguji',
'Sekretaris Penguji',
'Anggota Penguji',
];
}
public function map($sidangJadwal): array
{
// Format tanggal
$tanggal = Carbon::parse($sidangJadwal->tanggal_seminar)->format('d-m-Y');
// Gabungkan waktu mulai dan selesai
$waktu = '';
if ($sidangJadwal->sidangWaktu) {
$waktu = Carbon::parse($sidangJadwal->sidangWaktu->waktu_mulai)->format('H:i') . ' - ' . Carbon::parse($sidangJadwal->sidangWaktu->waktu_selesai)->format('H:i');
}
return [
$tanggal,
$waktu,
$sidangJadwal->sidangTempat->ruang,
$sidangJadwal->mahasiswa->name,
$sidangJadwal->dosenPanelis1->name,
$sidangJadwal->dosenPembimbing->name,
$sidangJadwal->dosenPanelis2->name,
];
}
}

View File

@ -0,0 +1,80 @@
<?php
namespace App\Http\Controllers;
use App\Models\User;
use App\Models\Kriteria;
use App\Models\Alternatif;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class AlternatifController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
$no = 1;
$mahasiswa = Auth::user()->id;
$alternatif = Alternatif::where('id_mahasiswa', $mahasiswa)->get();
$dosen = User::where('role', 'Dosen')->orderBy('name', 'ASC')->whereNotIn('name', Alternatif::where('id_mahasiswa', $mahasiswa)->pluck('nama'))->get();
$kriteria = Kriteria::get();
return view('alternatif', compact('no', 'mahasiswa', 'alternatif', 'dosen', 'kriteria'));
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
$request->validate([
'nama' => 'required',
'id_mahasiswa',
]);
$mahasiswa = Auth::user()->id;
Alternatif::create([
'nama' => $request->nama,
'id_mahasiswa' => $mahasiswa,
]);
return redirect('alternatif')->with('toast_success', 'Data Alternatif Berhasil Ditambahkan.');
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id)
{
$request->validate([
'nama' => 'required',
]);
$alternatif = Alternatif::find($id);
$alternatif->update($request->all());
return redirect('alternatif')->with('toast_success', 'Perubahan Berhasil Disimpan.');
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
$alternatif = Alternatif::find($id);
$alternatif->delete();
return redirect('alternatif')->with('toast_success', 'Data Alternatif Berhasil Dihapus.');
}
}

View File

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

View File

@ -0,0 +1,101 @@
<?php
namespace App\Http\Controllers;
use Carbon\Carbon;
use App\Models\User;
use App\Models\Pengajuan;
use Illuminate\Http\Request;
use App\Models\SettingPengajuan;
use Illuminate\Support\Facades\Auth;
class DaftarDosenController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
$no = 1;
$nomor = 1;
$dosen = User::where('role', 'Dosen')->orderByRaw("FIELD(prodi, 'MIF', 'TIF', 'TKK', 'BSD')")->orderBy('name', 'ASC')->get();
$pengajuan = Pengajuan::all();
$status = Pengajuan::get()->where('id_mahasiswa', auth()->user()->id);
return view('daftar-dosen', compact('no', 'nomor', 'dosen', 'pengajuan', 'status'));
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
$user = Auth::user();
$countPengajuan = Pengajuan::where('id_mahasiswa', $user->id)->count();
$maxPembimbing = SettingPengajuan::select('maxPembimbing')->first()->maxPembimbing;
if ($countPengajuan >= $maxPembimbing) {
return redirect('daftar-dosen')->with('toast_error', 'Pengajuan Dosen Pembimbing Telah Mencapai Batas Maksimum.');
}
$setting = SettingPengajuan::first();
$tglMulai = $setting->tglMulai;
$tglSelesai = $setting->tglSelesai;
$currentDate = Carbon::now();
if ($currentDate->lt($tglMulai)) {
return redirect()->back()->with('toast_error', 'Pengajuan Dosen Pembimbing Belum Dibuka.');
} elseif ($currentDate->gt($tglSelesai)) {
return redirect()->back()->with('toast_error', 'Pengajuan Dosen Pembimbing Sudah Ditutup.');
}
$request->validate([
'judul',
'ipk',
'jumlah_bimbingan',
'id_mahasiswa',
'id_dosen_pembimbing',
]);
$existingSubmission = Pengajuan::where('id_dosen_pembimbing', $request->id_dosen_pembimbing)->where('id_mahasiswa', $request->id_mahasiswa)->exists();
if ($existingSubmission) {
return redirect('daftar-dosen')->with('toast_error', 'Dosen Pembimbing Sudah Diajukan.');
}
try {
Pengajuan::create(array_merge($request->all(), ['nama' => $user->name]));
$user = User::find($request->id_mahasiswa);
$user->judul = $request->judul;
$user->ipk = $request->ipk;
$user->save();
return redirect('daftar-dosen')->with('toast_success', 'Pengajuan Dosen Pembimbing Berhasil.');
} catch (\Exception $e) {
return redirect('daftar-dosen')->with('toast_error', 'Pengajuan Dosen Pembimbing Gagal.')->withErrors($e->getMessage())->withInput();
}
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
//
}
}

View File

@ -0,0 +1,129 @@
<?php
namespace App\Http\Controllers;
use Carbon\Carbon;
use App\Models\User;
use App\Models\Pengajuan;
use Illuminate\Http\Request;
use App\Models\SeminarJadwal;
use App\Models\SettingSempro;
use App\Models\SeminarProposal;
use Illuminate\Support\Facades\Session;
class DaftarSemproController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
// Dapatkan pengguna saat ini
$user = auth()->user();
$user_id = $user->id;
// Dapatkan pengajuan yang disetujui berdasarkan ID mahasiswa
$pengajuan = Pengajuan::where('id_mahasiswa', $user->id)->where('status', 'Disetujui')->get();
// Ambil satu entri pertama dari SeminarProposal yang sesuai dengan kriteria
$seminarProposal = SeminarProposal::where('id_mahasiswa', $user->id)
->with('seminarJadwal')
->first();
$seminarJadwals = SeminarJadwal::where('id_mahasiswa', $user_id)->get();
return view('jadwal-sempro', compact('user_id', 'pengajuan', 'seminarProposal', 'seminarJadwals'));
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
$setting = SettingSempro::first();
$tglMulai = $setting->tgl_mulai_pendaftaran;
$tglSelesai = $setting->tgl_selesai_pendaftaran;
$currentDate = Carbon::now();
if ($currentDate->lt($tglMulai)) {
return redirect()->back()->with('toast_error', 'Pendaftaran Seminar Proposal Belum Dibuka.');
} elseif ($currentDate->gt($tglSelesai)) {
return redirect()->back()->with('toast_error', 'Pendaftaran Seminar Proposal Sudah Ditutup.');
}
// Validasi data
$request->validate([
'id_mahasiswa' => 'required',
'id_pengajuan' => 'required',
'judul' => 'required',
'berkas' => 'required|file|mimes:pdf,doc,docx|max:2048', // Sesuaikan dengan tipe berkas yang diizinkan dan batas ukuran yang diinginkan
]);
// Cek apakah sudah ada Seminar Proposal dengan ID Pengajuan yang sama
$existingSempro = SeminarProposal::where('id_pengajuan', $request->id_pengajuan)->exists();
if ($existingSempro) {
// Jika sudah ada, beri pesan error ke pengguna
Session::flash('toast_error', 'Sudah Mendaftar Seminar Proposal.');
// Redirect pengguna ke halaman sebelumnya
return redirect()->back();
}
// Coba untuk menyimpan berkas
try {
// Menyimpan berkas
$berkas = $request->file('berkas');
$nama_berkas = $berkas->getClientOriginalName();
$berkas->storeAs('public/berkas_sempro', $nama_berkas); // Menyimpan berkas di folder penyimpanan yang diinginkan
// Simpan data seminar proposal
SeminarProposal::create([
'id_mahasiswa' => $request->id_mahasiswa,
'id_pengajuan' => $request->id_pengajuan,
'berkas' => $nama_berkas,
]);
$mahasiswa = User::where('id', $request->id_mahasiswa);
$mahasiswa->update([
'judul' => $request->judul,
]);
$pengajuan = Pengajuan::where('id', $request->id_pengajuan)->first();
$pengajuan->update([
'judul' => $request->judul,
]);
// Set pesan toast sukses
Session::flash('toast_success', 'Pendaftaran Seminar Proposal Berhasil.');
} catch (\Exception $e) {
// Tangani kesalahan jika gagal menyimpan berkas
Session::flash('toast_error', 'Terjadi kesalahan saat menyimpan berkas: ' . $e->getMessage());
}
// Redirect pengguna ke halaman sebelumnya
return redirect()->route('jadwal-sempro');
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
//
}
}

View File

@ -0,0 +1,121 @@
<?php
namespace App\Http\Controllers;
use Carbon\Carbon;
use App\Models\Sidang;
use App\Models\Pengajuan;
use App\Models\SidangJadwal;
use Illuminate\Http\Request;
use App\Models\SettingSidang;
use App\Models\SeminarProposal;
use Illuminate\Support\Facades\Session;
class DaftarSidangController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
// Dapatkan pengguna saat ini
$user = auth()->user();
$user_id = $user->id;
// Dapatkan pengajuan yang disetujui berdasarkan ID mahasiswa
$pengajuan = Pengajuan::where('id_mahasiswa', $user->id)->where('status', 'Disetujui')->get();
$proposals = SeminarProposal::where('id_mahasiswa', $user->id)->get();
// Ambil satu entri pertama dari Sidang yang sesuai dengan kriteria
$sidang = Sidang::where('id_mahasiswa', $user->id)
->with('sidangJadwal')
->first();
$sidangJadwals = SidangJadwal::where('id_mahasiswa', $user_id)->get();
return view('jadwal-sidang', compact('user_id', 'pengajuan', 'proposals', 'sidang', 'sidangJadwals'));
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
$setting = SettingSidang::first();
$tglMulai = $setting->tgl_mulai_pendaftaran;
$tglSelesai = $setting->tgl_selesai_pendaftaran;
$currentDate = Carbon::now();
if ($currentDate->lt($tglMulai)) {
return redirect()->back()->with('toast_error', 'Pendaftaran Sidang Belum Dibuka.');
} elseif ($currentDate->gt($tglSelesai)) {
return redirect()->back()->with('toast_error', 'Pendaftaran Sidang Sudah Ditutup.');
}
// Validasi data
$request->validate([
'id_mahasiswa' => 'required|exists:users,id',
'id_pengajuan' => 'required|exists:pengajuan,id',
'id_seminar_proposal' => 'required|exists:seminar_proposal,id',
'berkas' => 'required|file|mimes:pdf,doc,docx|max:2048', // Sesuaikan dengan tipe berkas yang diizinkan dan batas ukuran yang diinginkan
]);
// Cek apakah sudah ada Seminar Proposal dengan ID Pengajuan yang sama
$existingSidang = Sidang::where('id_pengajuan', $request->id_pengajuan)->exists();
if ($existingSidang) {
// Jika sudah ada, beri pesan error ke pengguna
Session::flash('toast_error', 'Sudah Mendaftar Sidang.');
// Redirect pengguna ke halaman sebelumnya
return redirect()->route('daftar-sidang');
}
// Coba untuk menyimpan berkas
try {
// Menyimpan berkas
$berkas = $request->file('berkas');
$nama_berkas = $berkas->getClientOriginalName();
$berkas->storeAs('public/berkas_sidang', $nama_berkas); // Menyimpan berkas di folder penyimpanan yang diinginkan
// Simpan data seminar proposal
Sidang::create([
'id_mahasiswa' => $request->id_mahasiswa,
'id_pengajuan' => $request->id_pengajuan,
'id_seminar_proposal' => $request->id_seminar_proposal,
'berkas' => $nama_berkas,
]);
// Set pesan toast sukses
Session::flash('toast_success', 'Pendaftaran Sidang Berhasil.');
} catch (\Exception $e) {
// Tangani kesalahan jika gagal menyimpan berkas
Session::flash('toast_error', 'Terjadi kesalahan saat menyimpan berkas: ' . $e->getMessage());
}
// Redirect pengguna ke halaman sebelumnya
return redirect()->route('jadwal-sidang');
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
//
}
}

View File

@ -0,0 +1,163 @@
<?php
namespace App\Http\Controllers;
use App\Models\User;
use App\Models\Pengajuan;
use Illuminate\Http\Request;
use App\Models\SettingPengajuan;
use App\Models\Subkriteria;
use Illuminate\Support\Facades\Session;
class DaftarTungguController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
$no = 1;
$mahasiswa = User::where('role', 'Mahasiswa')->whereNotNull('judul')->where('pembimbing', NULL)->orderBy('name', 'ASC')->get();
$dosen = User::where('role', 'Dosen')->orderBy('prodi', 'ASC')->orderBy('name', 'ASC')->get();
return view('daftar-tunggu', compact('no', 'mahasiswa', 'dosen'));
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
$mahasiswas = User::where('role', 'Mahasiswa')->whereNotNull('judul')->where('pembimbing', NULL)->get();
$results = [];
// Mendapatkan prodi yang dipilih dari checkbox
$prodi = $request->input('prodi');
// Kata kunci untuk setiap kategori
$kategoriKeywords = [
'Sistem Pendukung Keputusan' => ['Sistem Pendukung Keputusan', 'Rekomendasi', 'Pemilihan', 'Penentuan'],
'Media Pembelajaran' => ['Media Pembelajaran', 'Augmented Reality', 'Game', 'Edukasi', 'Pembelajaran'],
'Sistem Pakar' => ['Sistem Pakar'],
'Sistem Informasi' => ['Sistem Informasi', 'Sistem Penjualan', 'Website'],
'Aplikasi Mobile' => ['Mobile', 'Android'],
'Data Mining' => ['Data Mining', 'Analisis', 'Visualisasi Data', 'Peramalan', 'Prediksi', 'Forecasting']
];
// Mengambil daftar jabatan dari database
$jabatanData = Subkriteria::where('id_kriteria', '2')->get();
$jabatanTertinggi = $jabatanData->pluck('nama_subkriteria')->toArray();
$jabatanTerendah = array_reverse($jabatanTertinggi);
foreach ($mahasiswas as $mahasiswa) {
$judul = $mahasiswa->judul;
$kategori = NULL;
foreach ($kategoriKeywords as $kategoriKey => $keywords) {
foreach ($keywords as $keyword) {
if (strpos($judul, $keyword) !== false) {
$kategori = $kategoriKey;
break 2; // Keluar dari kedua loop
}
}
}
// Tentukan urutan jabatan berdasarkan IPK mahasiswa
$jabatanUrut = $mahasiswa->ipk >= 3.75 ? $jabatanTerendah : $jabatanTertinggi;
$randomDosen = null;
// Loop melalui urutan jabatan
foreach ($jabatanUrut as $jabatan) {
// Mendapatkan dosen berdasarkan jabatan dan kategori
$dosens = User::where(function($query) use ($jabatan) {
if ($jabatan === 'Dosen') {
$query->where('jabatan', $jabatan)
->orWhereNull('jabatan');
} else {
$query->where('jabatan', $jabatan);
}
})
->where(function($query) use ($kategori) {
$query->where('keahlian', 'like', "%$kategori%")
->orWhere('minat', 'like', "%$kategori%");
})
->whereIn('prodi', $prodi)
->get();
// Filter dosen yang kuotanya belum penuh
$availableDosens = $dosens->reject(function ($dosen) {
$settingPengajuan = SettingPengajuan::first();
$maxMahasiswa = $settingPengajuan->maxMahasiswa;
return User::where('pembimbing', $dosen->name)->count() >= $maxMahasiswa;
});
// Jika ada dosen yang tersedia, pilih salah satu secara acak
if ($availableDosens->isNotEmpty()) {
$randomDosen = $availableDosens->random();
break; // Keluar dari loop jabatan setelah menemukan dosen
}
}
// Jika tidak menemukan dosen yang tersedia dalam urutan jabatan yang ditentukan
if (!$randomDosen) {
$dosens = User::where(function($query) use ($jabatanUrut) {
$query->whereIn('jabatan', $jabatanUrut)
->orWhereNull('jabatan');
})
->whereIn('prodi', $prodi)
->get();
$randomDosen = $dosens->random();
}
$results[] = [
'mahasiswa' => $mahasiswa,
'dosen' => $randomDosen,
'dosens' => $dosens
];
}
Session::put('pembimbing', $results);
return view('daftar-tunggu', compact('results'))->with('toast_success', 'Generate Dosen Pembimbing Berhasil');
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request)
{
$dosenSelections = $request->input('pembimbing');
$results = Session::get('pembimbing');
foreach ($results as $result) {
$mahasiswa = $result['mahasiswa'];
$selectedDosen = $dosenSelections[$mahasiswa->id];
$mahasiswa->update([
'pembimbing' => $selectedDosen,
]);
}
Session::forget('pembimbing'); // Hapus session setelah disimpan
return redirect()->route('daftar-tunggu')->with('toast_success', 'Dosen Pembimbing Berhasil Disimpan');
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
//
}
}

View File

@ -0,0 +1,142 @@
<?php
namespace App\Http\Controllers;
use App\Models\User;
use App\Models\Pengajuan;
use App\Models\SeminarJadwal;
use App\Models\SettingPengajuan;
use App\Models\SettingSempro;
use App\Models\SettingSidang;
use App\Models\SidangJadwal;
use App\Models\Subkriteria;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class DashboardController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
if (Auth::User()->role == 'Admin') {
$dosen = User::where('role', 'Dosen')->count();
$mahasiswa = User::where('role', 'Mahasiswa')->count();
$diajukan = Pengajuan::where('status', 'Menunggu Persetujuan')->count();
$no = 1;
$pengajuan = Pengajuan::where('status', 'Menunggu Persetujuan')->take(5)->orderBy('updated_at', 'DESC')->get();
return view('dashboard-admin', compact('dosen', 'mahasiswa', 'diajukan', 'no', 'pengajuan'));
} elseif (Auth::User()->role == 'Dosen') {
$diajukan = Pengajuan::where('status', 'Menunggu Persetujuan')->where('id_dosen_pembimbing', Auth::user()->id)->count();
$disetujui = Pengajuan::where('status', 'Disetujui')->where('id_dosen_pembimbing', Auth::user()->id)->count();
$no = 1;
$pengajuan = Pengajuan::where('status', 'Menunggu Persetujuan')->where('id_dosen_pembimbing', Auth::user()->id)->take(5)->orderBy('updated_at', 'DESC')->get();
$kategori = Subkriteria::where('id_kriteria', '1')->get();
$jabatan = Subkriteria::where('id_kriteria', '2')->get();
return view('dashboard-dosen', compact('diajukan', 'disetujui', 'no', 'pengajuan', 'kategori', 'jabatan'));
} else if (Auth::User()->role == 'Mahasiswa') {
$kategori = Subkriteria::where('id_kriteria', '1')->get();
$jabatan = Subkriteria::where('id_kriteria', '2')->get();
$settingPengajuan = SettingPengajuan::first();
$tglMulai = $settingPengajuan ? $settingPengajuan->tglMulai : NULL;
$tglSelesai = $settingPengajuan ? $settingPengajuan->tglSelesai : NULL;
$settingSempro = SettingSempro::first();
$mulaiSempro = $settingSempro ? $settingSempro->tgl_mulai_pendaftaran : NULL;
$akhirSempro = $settingSempro ? $settingSempro->tgl_akhir_pendaftaran : NULL;
$settingSidang = SettingSidang::first();
$mulaiSidang = $settingSidang ? $settingSidang->tgl_mulai_pendaftaran : NULL;
$akhirSidang = $settingSidang ? $settingSidang->tgl_akhir_pendaftaran : NULL;
$userID = auth()->id();
// Ambil tanggal seminar dari SeminarJadwal untuk user ID tertentu
$tanggalSeminar = SeminarJadwal::where('id_mahasiswa', $userID)
->pluck('tanggal_seminar')
->first();
// Jika ada tanggal seminar, ubah formatnya menjadi "DD-MM-YYYY"
if ($tanggalSeminar) {
$tanggalSeminar = date('d-m-Y', strtotime($tanggalSeminar));
}
// Ambil tanggal sidang dari SidangJadwal untuk user ID tertentu
$tanggalSidang = SidangJadwal::where('id_mahasiswa', $userID)
->pluck('tanggal_sidang')
->first();
// Jika ada tanggal sidang, ubah formatnya menjadi "DD-MM-YYYY"
if ($tanggalSidang) {
$tanggalSidang = date('d-m-Y', strtotime($tanggalSidang));
}
return view('dashboard-mahasiswa', compact('kategori', 'jabatan', 'tglMulai', 'tglSelesai', 'mulaiSempro', 'akhirSempro', 'mulaiSidang', 'akhirSidang'));
} else {
return view('welcome');
}
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id)
{
if (Auth::User()->role == 'Dosen') {
$request->validate([
'name' => 'required',
'nomor' => 'required',
'prodi' => 'required',
'jabatan' => 'required',
'keahlian' => 'required',
'minat' => 'required',
]);
$dosen = User::find($id);
$dosen->update($request->all());
return redirect('dashboard')->with('toast_success', 'Perubahan Berhasil Disimpan.');
} elseif (Auth::User()->role == 'Mahasiswa') {
$request->validate([
'name' => 'required',
'nomor' => 'required',
'golongan' => 'required',
'angkatan' => 'required',
]);
$mahasiswa = User::find($id);
$mahasiswa->update($request->all());
return redirect('dashboard')->with('toast_success', 'Perubahan Berhasil Disimpan.');
}
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
//
}
}

View File

@ -0,0 +1,69 @@
<?php
namespace App\Http\Controllers;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
class DosenController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
$no = 1;
$dosen = User::where('role', 'Dosen')->orderBy('prodi', 'ASC')->orderBy('name', 'ASC')->get();
// $dosen = User::where('role', 'Dosen')->where('prodi', 'MIF')->orderBy('name', 'ASC')->get();
return view('dosen', compact('no', 'dosen'));
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
$request->validate([
'name' => 'required|string|max:255',
'prodi' => 'required|string|max:255',
'email' => 'required|string|email|max:255|unique:users',
'password' => 'required|string|min:8',
]);
User::create([
'name' => $request->name,
'name' => $request->prodi,
'email' => $request->email,
'password' => Hash::make($request->password),
'role' => 'Dosen',
]);
return redirect('dosen')->with('toast_success', 'Akun Dosen Berhasil Didaftarkan.');
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id)
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
//
}
}

View File

@ -0,0 +1,160 @@
<?php
namespace App\Http\Controllers;
use App\Models\Kriteria;
use App\Models\Penilaian;
use App\Models\Alternatif;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class HasilController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
$kriteria = Kriteria::where('status', 'Aktif')->orderby('id')->get();
$alternatif = Alternatif::where('id_mahasiswa', Auth::user()->id)->get();
for ($a = 0; $a < count($alternatif); $a++) {
$penilaian = Penilaian::where('id_alternatif', $alternatif[$a]->id)
->join('kriteria', 'kriteria.id', '=', 'penilaian.id_kriteria')
->join('nilai','kriteria.id','=','nilai.id_kriteria')
->select(
'penilaian.id',
'penilaian.id_alternatif',
'penilaian.id_kriteria',
'penilaian.nilai',
'kriteria.jenis',
'kriteria.nama_kriteria',
'nilai.nilai as bobot'
)
->orderby('penilaian.id_kriteria')->get();
$alternatif[$a]->penilaian = $penilaian;
}
$pembagi = array();
$matriks = $alternatif;
for ($b = 0; $b < count($kriteria); $b++) {
$temp = 0;
for ($c = 0; $c < count($matriks); $c++) {
$temp2 = $matriks[$c]->penilaian[$b]->nilai;
$temp += pow($temp2, 2);
}
array_push($pembagi, sqrt($temp));
}
for ($d = 0; $d < count($matriks); $d++) {
for ($e = 0; $e < count($pembagi); $e++) {
$matriks[$d]->penilaian[$e]->nilai_ternormalisasi = $matriks[$d]->penilaian[$e]->nilai / $pembagi[$e];
}
}
$matriks_nilai = $matriks;
for ($f = 0; $f < count($matriks_nilai); $f++) {
for ($g = 0; $g < count($matriks_nilai[$f]->penilaian); $g++) {
$matriks_nilai[$f]->penilaian[$g]->nilai_ternormalisasi_nilai = ($matriks_nilai[$f]->penilaian[$g]->nilai_ternormalisasi * $matriks_nilai[$f]->penilaian[$g]->bobot);
}
}
$nilai_optimasi_1 = $matriks_nilai;
for ($h = 0; $h < count($nilai_optimasi_1); $h++) {
$temp3 = 0;
for ($i = 0; $i < count($nilai_optimasi_1[$h]->penilaian); $i++) {
if ($nilai_optimasi_1[$h]->penilaian[$i]->jenis == 'Benefit') {
$temp3 += $nilai_optimasi_1[$h]->penilaian[$i]->nilai_ternormalisasi_nilai;
} else {
$temp3 -= $nilai_optimasi_1[$h]->penilaian[$i]->nilai_ternormalisasi_nilai;
}
}
$nilai_optimasi_1[$h]->optimasi_1 = $temp3;
}
$nilai_optimasi_2 = $matriks_nilai;
for ($h = 0; $h < count($nilai_optimasi_2); $h++) {
$min = 0;
$max = 0;
for ($i = 0; $i < count($matriks_nilai[$h]->penilaian); $i++) {
if ($matriks_nilai[$h]->penilaian[$i]->jenis == 'Cost') {
$min += $matriks_nilai[$h]->penilaian[$i]->nilai_ternormalisasi_nilai;
} else {
$max += $matriks_nilai[$h]->penilaian[$i]->nilai_ternormalisasi_nilai;
}
}
if ($min != 0 && $max != 0) {
$matriks_nilai[$h]->optimasi_2 = $max / $min;
} elseif ($min == 0 && $max != 0) {
$matriks_nilai[$h]->optimasi_2 = $max;
} else {
$matriks_nilai[$h]->optimasi_2 = $min;
}
}
$arr_1 = array();
$arr_2 = array();
for ($j = 0; $j < count($nilai_optimasi_2); $j++) {
array_push($arr_1, $nilai_optimasi_2[$j]->optimasi_1);
array_push($arr_2, $nilai_optimasi_2[$j]->optimasi_2);
}
$rank_1 = array();
$ordered_1 = $arr_1;
rsort($ordered_1);
foreach ($arr_1 as $key => $value) {
foreach ($ordered_1 as $ordered_key => $ordered_value) {
if ($value === $ordered_value) {
$key = $ordered_key;
break;
}
}
array_push($rank_1, $key + 1);
}
$rank_2 = array();
$ordered_2 = $arr_2;
rsort($ordered_2);
foreach ($arr_2 as $key1 => $value1) {
foreach ($ordered_2 as $ordered_key1 => $ordered_value1) {
if ($value1 === $ordered_value1) {
$key1 = $ordered_key1;
break;
}
}
array_push($rank_2, $key1 + 1);
}
return view('hasil', compact('kriteria', 'alternatif', 'pembagi', 'matriks', 'matriks_nilai', 'nilai_optimasi_1', 'nilai_optimasi_2', 'rank_1', 'rank_2'));
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
//
}
}

View File

@ -0,0 +1,74 @@
<?php
namespace App\Http\Controllers;
use App\Models\User;
use App\Models\Kriteria;
use Illuminate\Http\Request;
class KriteriaController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
$no = 1;
$kriteria = Kriteria::get();
$dosen = User::where('role', 'Dosen')->get();
return view('kriteria', compact('no', 'kriteria', 'dosen'));
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
$request->validate([
'nama_kriteria' => 'required',
'status' => 'required',
'jenis' => 'required',
]);
Kriteria::create($request->all());
return redirect('kriteria')->with('toast_success', 'Data Kriteria Berhasil Ditambahkan.');
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id)
{
$request->validate([
'nama_kriteria' => 'required',
'status' => 'required',
'jenis' => 'required',
]);
$kriteria = Kriteria::find($id);
$kriteria->update($request->all());
return redirect('kriteria')->with('toast_success', 'Perubahan Berhasil Disimpan.');
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
$kriteria = Kriteria::find($id);
$kriteria->delete();
return redirect('kriteria')->with('toast_success', 'Data Kriteria Berhasil Dihapus.');
}
}

View File

@ -0,0 +1,77 @@
<?php
namespace App\Http\Controllers;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class MahasiswaController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index(Request $request)
{
if(Auth::User()->role=='Admin')
{
$no = 1;
$tahun = User::where('role', 'Mahasiswa')->distinct()->pluck('angkatan');
$angkatan = $request->angkatan;
$mahasiswa = User::where('role', 'Mahasiswa')->orderBy('golongan', 'ASC')->orderBy('name', 'ASC')->when($angkatan, function ($query, $angkatan) {
return $query->where('angkatan', $angkatan);
})->get();
$dosen = User::where('role', 'Dosen')->orderBy('prodi', 'ASC')->orderBy('name', 'ASC')->get();
return view('mahasiswa', compact('no', 'tahun', 'angkatan', 'mahasiswa', 'dosen'));
}
if(Auth::User()->role=='Dosen')
{
$no = 1;
$dosens = Auth::user()->name;
$tahun = User::where('role', 'Mahasiswa')->distinct()->pluck('angkatan');
$angkatan = $request->angkatan;
$mahasiswa = User::where('role', 'Mahasiswa')->where('pembimbing', $dosens)->orderBy('golongan', 'ASC')->orderBy('name', 'ASC')->when($angkatan, function ($query, $angkatan) {
return $query->where('angkatan', $angkatan);
})->get();
$dosen = User::where('role', 'Dosen')->orderBy('prodi', 'ASC')->orderBy('name', 'ASC')->get();
return view('mahasiswa', compact('no', 'tahun', 'angkatan', 'dosen', 'dosens', 'mahasiswa'));
}
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id)
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
//
}
}

View File

@ -0,0 +1,54 @@
<?php
namespace App\Http\Controllers;
use App\Models\Pengajuan;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class PembimbingController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
$no = 1;
$pengajuan = Pengajuan::get()->where('id_mahasiswa', auth()->user()->id);
return view('pembimbing', compact('no', 'pengajuan'));
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
//
}
}

View File

@ -0,0 +1,224 @@
<?php
namespace App\Http\Controllers;
use App\Models\User;
use App\Models\Pengajuan;
use Illuminate\Http\Request;
use App\Models\SettingPengajuan;
use Illuminate\Support\Facades\Auth;
class PengajuanController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index(Request $request)
{
$no = 1;
$tahuns = Pengajuan::where('status', 'Menunggu Persetujuan')->selectRaw('YEAR(created_at) as year')->groupBy('year')->pluck('year');
$tahun = $request->tahun;
if (Auth::User()->role == 'Admin') {
$pengajuans = Pengajuan::with('mahasiswa')->whereIn(Pengajuan::raw('YEAR(created_at)'), $tahuns)->where('status', 'Menunggu Persetujuan')->orderBy('created_at', 'DESC')->when($tahun, function ($query, $tahun) {
return $query->whereYear('created_at', $tahun);
})->get();
} elseif (Auth::User()->role == 'Dosen') {
$pengajuans = Pengajuan::with('mahasiswa')->whereIn(Pengajuan::raw('YEAR(created_at)'), $tahuns)->where('id_dosen_pembimbing', Auth::user()->id)->where('status', 'Menunggu Persetujuan')->orderBy('created_at', 'DESC')->when($tahun, function ($query, $tahun) {
return $query->whereYear('created_at', $tahun);
})->get();
}
$dosen = User::where('role', 'Dosen')->get();
$status = []; // Inisialisasi array untuk menyimpan status dari setiap pengajuan
foreach ($pengajuans as $pengajuan) {
$judul = $pengajuan->judul;
$kategori = NULL; // Inisialisasi kategori
// Kata kunci untuk setiap kategori
$kategoriKeywords = [
'Sistem Pendukung Keputusan' => ['Sistem Pendukung Keputusan', 'Rekomendasi', 'Pemilihan', 'Penentuan'],
'Media Pembelajaran' => ['Media Pembelajaran', 'Augmented Reality', 'Game', 'Edukasi', 'Pembelajaran'],
'Sistem Pakar' => ['Sistem Pakar'],
'Sistem Informasi' => ['Sistem Informasi', 'Sistem Penjualan', 'Website'],
'Aplikasi Mobile' => ['Mobile', 'Android'],
'Data Mining' => ['Data Mining', 'Analisis', 'Visualisasi Data', 'Peramalan', 'Prediksi', 'Forecasting']
];
// Loop melalui setiap kategori dan kata kunci
foreach ($kategoriKeywords as $kategoriKey => $keywords) {
foreach ($keywords as $keyword) {
// Jika judul mengandung kata kunci, atur kategori
if (strpos($judul, $keyword) !== false) {
$kategori = $kategoriKey;
break 2; // Keluar dari kedua loop
}
}
}
// Inisialisasi array untuk menyimpan status dari setiap dosen untuk pengajuan saat ini
$pengajuanStatus = [];
// Lakukan pengecekan kesesuaian kategori dengan keahlian/minat dosen
foreach ($dosen as $dsn) {
// Inisialisasi status untuk dosen saat ini
$dosenStatus = '';
// Jika keahlian/minat dosen sama dengan kategori judul mahasiswa, atur status kesesuaian
if ($dsn->keahlian == NULL || $dsn->minat == NULL) {
$dosenStatus = 'Tidak Sesuai';
} elseif ($dsn->keahlian == $kategori || $dsn->minat == $kategori) {
$dosenStatus = 'Sesuai';
} else {
$dosenStatus = 'Tidak Sesuai';
}
// Tambahkan status dosen saat ini ke dalam array untuk pengajuan saat ini
$pengajuanStatus[] = $dosenStatus;
}
// Tambahkan array status untuk pengajuan saat ini ke dalam array status keseluruhan
$status[] = $pengajuanStatus;
}
return view('pengajuan', compact('no', 'tahuns', 'tahun', 'pengajuans', 'dosen', 'status'));
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id)
{
// Ambil data dosen yang akan disetujui pengajuannya
$idDosenPembimbing = $request->input('id_dosen_pembimbing');
// Hitung jumlah pengajuan yang sudah disetujui oleh dosen tersebut
$countPengajuan = Pengajuan::where('id_dosen_pembimbing', $idDosenPembimbing)->where('status', 'Disetujui')->count();
// Ambil batas maksimum mahasiswa per dosen
$maxMahasiswa = SettingPengajuan::select('maxMahasiswa')->first()->maxMahasiswa;
// Cek apakah jumlah pengajuan yang disetujui sudah mencapai batas maksimum
if ($countPengajuan >= $maxMahasiswa) {
return redirect('pengajuan')->with('toast_error', 'Persetujuan Dosen Pembimbing Telah Mencapai Batas ' . $maxMahasiswa . ' Mahasiswa');
}
$request->validate([
'judul' => 'required',
'id_dosen_pembimbing' => 'required',
]);
$pengajuan = Pengajuan::find($id);
$existingApproval = Pengajuan::where('id_mahasiswa', $pengajuan->id_mahasiswa)->where('status', 'Disetujui')->where('id', '!=', $id)->exists();
if ($existingApproval) {
return redirect('pengajuan')->with('toast_error', 'Mahasiswa Sudah Memiliki Dosen Pembimbing.');
}
$pengajuan->update([
'status' => 'Disetujui',
'id_dosen_pembimbing' => $request->id_dosen_pembimbing
]);
$dosen = User::find($request->id_dosen_pembimbing);
$mahasiswa = User::where('id', $pengajuan->id_mahasiswa);
$mahasiswa->update([
'judul' => $request->judul,
'pembimbing' => $dosen->name,
]);
return redirect('pengajuan')->with('toast_success', 'Pengajuan Dosen Pembimbing Diterima.');
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
//
}
/**
* Accept the specified resource in storage.
*/
public function accept(Request $request, $id)
{
$user = Auth::user();
$countPengajuan = Pengajuan::where('id_dosen_pembimbing', $user->id)->where('status', 'Disetujui')->count();
$maxMahasiswa = SettingPengajuan::select('maxMahasiswa')->first()->maxMahasiswa;
if ($countPengajuan >= $maxMahasiswa) {
return redirect('pengajuan')->with('toast_error', 'Persetujuan Dosen Pembimbing Telah Mencapai Batas ' . $maxMahasiswa . ' Mahasiswa');
}
$request->validate([
'judul' => 'required',
'id_dosen_pembimbing' => 'required',
]);
$pengajuan = Pengajuan::find($id);
$existingApproval = Pengajuan::where('id_mahasiswa', $pengajuan->id_mahasiswa)->where('status', 'Disetujui')->where('id', '!=', $id)->exists();
if ($existingApproval) {
return redirect('pengajuan')->with('toast_error', 'Mahasiswa Sudah Memiliki Dosen Pembimbing.');
}
$pengajuan->update([
'status' => 'Disetujui'
]);
$dosen = User::find($request->id_dosen_pembimbing);
$mahasiswa = User::where('id', $pengajuan->id_mahasiswa);
$mahasiswa->update([
'judul' => $request->judul,
'pembimbing' => $dosen->name,
]);
return redirect('pengajuan')->with('toast_success', 'Pengajuan Dosen Pembimbing Diterima.');
}
/**
* Decline the specified resource from storage.
*/
public function decline(Request $request, $id)
{
$request->validate([
'judul' => 'required',
]);
$pengajuan = Pengajuan::find($id);
$pengajuan->update([
'status' => 'Ditolak'
]);
$mahasiswa = User::where('id', $pengajuan->id_mahasiswa);
$mahasiswa->update([
'judul' => $request->judul,
]);
return redirect('pengajuan')->with('toast_success', 'Pengajuan Dosen Pembimbing Ditolak.');
}
}

View File

@ -0,0 +1,127 @@
<?php
namespace App\Http\Controllers;
use App\Models\Kriteria;
use App\Models\Penilaian;
use App\Models\Alternatif;
use App\Models\Subkriteria;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class PenilaianController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
$no = 1;
$kriteria = Kriteria::where('status', 'Aktif')->with('SubKriteria')->get();
$subkriteria = Subkriteria::all();
$subkriteria = Subkriteria::whereHas('kriteria', function($query) {
$query->where('status', 'Aktif');
})->get();
$alternatif = Alternatif::where('id_mahasiswa', Auth::user()->id)->orderBy('id')->get();
$nilai = Penilaian::all();
for ($i = 0; $i < count($alternatif); $i++) {
$penilaian = Penilaian::where('id_alternatif', $alternatif[$i]->id)->orderby('id_kriteria')->get();
if (count($penilaian) != 0) {
$alternatif[$i]->penilaian = $penilaian;
} else {
$alternatif[$i]->penilaian = "null";
}
}
return view('penilaian', compact('no', 'kriteria', 'subkriteria', 'alternatif', 'penilaian'));
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request, $id)
{
$kriteria = Kriteria::where('status', 'Aktif')->orderby('id')->get();
// Cek apakah request memiliki data untuk setiap kriteria
$dataExist = false;
foreach ($kriteria as $k) {
$idk = $k->id;
if ($request->has($idk) && $request->filled($idk)) {
$dataExist = true;
break;
}
}
if (!$dataExist) {
// Jika tidak ada data, tampilkan toast_error
return redirect('penilaian')->with('toast_error', 'Penilaian Alternatif Gagal Ditambahkan');
}
$cek = Penilaian::where('id_alternatif', $id)->get();
if (count($cek) == 0) {
foreach ($kriteria as $k) {
$idk = $k->id;
Penilaian::create([
'id_alternatif' => $id,
'id_kriteria' => $k->id,
'nilai' => $request->$idk,
]);
}
return redirect('penilaian')->with('toast_success', 'Penilaian Alternatif Berhasil Ditambahkan.');
} else {
return back();
}
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id)
{
$kriteria = Kriteria::where('status', 'Aktif')->orderby('id')->get();
// Cek apakah request memiliki data untuk setiap kriteria
$dataExist = false;
foreach ($kriteria as $k) {
$idk = $k->id;
if ($request->has($idk) && $request->filled($idk)) {
$dataExist = true;
break;
}
}
if (!$dataExist) {
// Jika tidak ada data, tampilkan toast_error
return redirect('penilaian')->with('toast_error', 'Tidak Ada Perubahan Data');
}
foreach ($kriteria as $k) {
$idk = $k->id;
Penilaian::where('id_alternatif', $id)->where('id_kriteria', $k->id)->update([
'nilai' => $request->$idk
]);
}
return redirect('penilaian')->with('toast_success', 'Perubahan Berhasil Disimpan.');
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
//
}
}

View File

@ -0,0 +1,172 @@
<?php
namespace App\Http\Controllers;
use App\Models\Kriteria;
use App\Models\Nilai;
use App\Models\Perbandingan;
use Illuminate\Http\Request;
class PerbandinganController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
$no = 1;
$kriteria = Kriteria::where('status', 'Aktif')->get();
$id_kriteria = Kriteria::where('status', 'Aktif')->select('id')->get();
$count = Kriteria::count();
if (Perbandingan::get()->count() != pow($count, 2)) {
Perbandingan::truncate();
foreach ($kriteria as $k1) {
foreach ($kriteria as $k2) {
Perbandingan::create([
'id_kriteria_1' => $k1->id,
'id_kriteria_2' => $k2->id,
'nilai' => 1
]);
}
}
}
$perbandingan = Perbandingan::get();
$nilai = Nilai::get();
if ($nilai->count() > 0) {
$arr_idk = array();
foreach ($id_kriteria as $idk) {
array_push($arr_idk, $idk->id);
}
$total = array_fill(0, $count, 0);
for ($i = 0; $i < $count; $i++) {
$temp = 0;
for ($j = 0; $j < $count; $j++) {
$p = Perbandingan::where('id_kriteria_1', '=', $arr_idk[$j])->where('id_kriteria_2', '=', $arr_idk[$i])->get()->first();
$temp += $p->nilai;
}
$total[$i] = $temp;
}
$tabel_nilai = array_fill(0, $count, array_fill(0, $count, 0));
for ($i = 0; $i < $count; $i++) {
for ($j = 0; $j < $count; $j++) {
$p = Perbandingan::where('id_kriteria_1', '=', $arr_idk[$i])->where('id_kriteria_2', '=', $arr_idk[$j])->get()->first();
$tabel_nilai[$j][$i] = $p->nilai / $total[$j];
}
}
$tabel_nilai_total = array_fill(0, $count, 0);
$pv = array_fill(0, $count, 0);
for ($i = 0; $i < $count; $i++) {
$tt = 0;
for ($j = 0; $j < $count; $j++) {
$tt += $tabel_nilai[$j][$i];
}
$tabel_nilai_total[$i] = $tt;
$pv[$i] = $tt / $count;
}
$lambdaMax = 0;
for($i=0;$i<$count;$i++)
{
$lambdaMax += $total[$i]*$pv[$i];
}
$tab_rand_index = [1 => 0.0, 2 => 0.0, 3 => 0.58, 4 => 0.90, 5 => 1.12, 6 => 1.24, 7 => 1.32, 8 => 1.41, 9 => 1.45, 10 => 1.49];
$ci = ($lambdaMax - $count) / ($count - 1);
$cr = $ci / $tab_rand_index[$count];
return view('perbandingan', compact('no', 'kriteria', 'perbandingan', 'id_kriteria', 'nilai', 'lambdaMax', 'ci', 'cr'));
}
return view('perbandingan', compact('no', 'kriteria', 'perbandingan', 'id_kriteria'));
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
$kriteria = Kriteria::where('status', 'Aktif')->get();
$id_kriteria = Kriteria::where('status', 'Aktif')->select('id')->get();
$arr_idk = array();
foreach ($id_kriteria as $idk) {
array_push($arr_idk, $idk->id);
}
$count = Kriteria::count();
$total = array_fill(0, $count, 0);
for ($i = 0; $i < $count; $i++) {
$temp = 0;
for ($j = 0; $j < $count; $j++) {
$p = Perbandingan::where('id_kriteria_1', '=', $arr_idk[$i])->where('id_kriteria_2', '=', $arr_idk[$j])->get()->first();
$p->nilai = $request[$arr_idk[$i] . ":" . $arr_idk[$j]];
$temp += $request[$arr_idk[$j] . ":" . $arr_idk[$i]];
$p->save();
}
$total[$i] = $temp;
}
$tabel_nilai = array_fill(0, $count, array_fill(0, $count, 0));
for ($i = 0; $i < $count; $i++) {
for ($j = 0; $j < $count; $j++) {
$tabel_nilai[$j][$i] = $request[$arr_idk[$i] . ":" . $arr_idk[$j]] / $total[$j];
}
}
$tabel_nilai_total = array_fill(0, $count, 0);
$pv = array_fill(0, $count, 0);
for ($i = 0; $i < $count; $i++) {
$tt = 0;
for ($j = 0; $j < $count; $j++) {
$tt += $tabel_nilai[$j][$i];
}
$tabel_nilai_total[$i] = $tt;
$pv[$i] = $tt / $count;
}
foreach ($kriteria as $index => $k) {
$nilai = nilai::where('id_kriteria', '=', $k->id)->first();
if ($nilai == null) {
nilai::create([
'id_kriteria' => $k->id,
'nilai' => $pv[$index],
]);
} else {
$nilai->nilai = $pv[$index];
$nilai->save();
}
}
return redirect('perbandingan');
}
/**
* Display the specified resource.
*/
public function show($id)
{
$nilai = Nilai::where('id_kriteria', $id)->first();
return $nilai->nilai;
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
//
}
}

View File

@ -0,0 +1,65 @@
<?php
namespace App\Http\Controllers;
use App\Models\User;
use Illuminate\Http\Request;
use App\Models\SeminarProposal;
class PesertaSemproController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index(Request $request)
{
$no = 1;
// Filter Tahun
$tahuns = SeminarProposal::selectRaw('YEAR(created_at) as year')->groupBy('year')->pluck('year');
$tahun = $request->tahun;
// Tangani filter tahun
$seminarProposals = SeminarProposal::whereIn(SeminarProposal::raw('YEAR(created_at)'), $tahuns)
->when($tahun, function ($query, $tahun) {
return $query->whereYear('created_at', $tahun);
})
->with(['mahasiswa', 'pengajuan.dosenPembimbing']);
$seminarProposals = $seminarProposals->get();
// Mengembalikan view dengan data seminar proposal
return view('peserta-sempro', compact('no', 'tahun', 'tahuns', 'seminarProposals'));
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
//
}
}

View File

@ -0,0 +1,64 @@
<?php
namespace App\Http\Controllers;
use App\Models\User;
use App\Models\Sidang;
use Illuminate\Http\Request;
class PesertaSidangController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index(Request $request)
{
$no = 1;
// Filter Tahun
$tahuns = Sidang::selectRaw('YEAR(created_at) as year')->groupBy('year')->pluck('year');
$tahun = $request->tahun;
// Tangani filter tahun
$sidangs = Sidang::whereIn(Sidang::raw('YEAR(created_at)'), $tahuns)
->when($tahun, function ($query, $tahun) {
return $query->whereYear('created_at', $tahun);
})
->with(['mahasiswa', 'pengajuan.dosenPembimbing']);
$sidangs = $sidangs->get();
return view('peserta-sidang', compact('no', 'tahun', 'tahuns', 'sidangs'));
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
//
}
}

View File

@ -0,0 +1,175 @@
<?php
namespace App\Http\Controllers;
use App\Models\User;
use App\Models\Kriteria;
use App\Models\Penilaian;
use App\Models\Alternatif;
use App\Models\Subkriteria;
use Illuminate\Http\Request;
class RekomendasiController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
$kategori = Subkriteria::where('id_kriteria', '1')->get();
$dosen = User::where('role', 'Dosen')->get();
$no = 1;
$alternatif = Alternatif::orderBy('nama', 'ASC')->get();
$dosen = User::where('role', 'Dosen')->orderBy('name', 'ASC')->whereNotIn('name', Alternatif::pluck('nama'))->get();
$kriteria = Kriteria::select('nama_kriteria')->orderby('id')->get();
for ($i = 0; $i < count($alternatif); $i++) {
$penilaian = Penilaian::where('id_alternatif', $alternatif[$i]->id)->orderby('id_kriteria')->get();
if (count($penilaian) != 0) {
$alternatif[$i]->penilaian = $penilaian;
} else {
$alternatif[$i]->penilaian = "null";
}
}
for ($a = 0; $a < count($alternatif); $a++) {
$penilaian = Penilaian::where('id_alternatif', $alternatif[$a]->id)
->join('kriteria', 'kriteria.id', '=', 'penilaian.id_kriteria')
->join('nilai','kriteria.id','=','nilai.id_kriteria')
->select(
'penilaian.id',
'penilaian.id_alternatif',
'penilaian.id_kriteria',
'penilaian.nilai',
'kriteria.jenis',
'kriteria.nama_kriteria',
'nilai.nilai as bobot'
)
->orderby('penilaian.id_kriteria')->get();
$alternatif[$a]->penilaian = $penilaian;
}
$pembagi = array();
$matriks = $alternatif;
for ($b = 0; $b < count($kriteria); $b++) {
$temp = 0;
for ($c = 0; $c < count($matriks); $c++) {
$temp2 = $matriks[$c]->penilaian[$b]->nilai;
$temp += pow($temp2, 2);
}
array_push($pembagi, sqrt($temp));
}
for ($d = 0; $d < count($matriks); $d++) {
for ($e = 0; $e < count($pembagi); $e++) {
$matriks[$d]->penilaian[$e]->nilai_ternormalisasi = $matriks[$d]->penilaian[$e]->nilai / $pembagi[$e];
}
}
$matriks_nilai = $matriks;
for ($f = 0; $f < count($matriks_nilai); $f++) {
for ($g = 0; $g < count($matriks_nilai[$f]->penilaian); $g++) {
$matriks_nilai[$f]->penilaian[$g]->nilai_ternormalisasi_nilai = ($matriks_nilai[$f]->penilaian[$g]->nilai_ternormalisasi * $matriks_nilai[$f]->penilaian[$g]->bobot);
}
}
$nilai_optimasi_1 = $matriks_nilai;
for ($h = 0; $h < count($nilai_optimasi_1); $h++) {
$temp3 = 0;
for ($i = 0; $i < count($nilai_optimasi_1[$h]->penilaian); $i++) {
if ($nilai_optimasi_1[$h]->penilaian[$i]->jenis == 'benefit') {
$temp3 += $nilai_optimasi_1[$h]->penilaian[$i]->nilai_ternormalisasi_nilai;
} else {
$temp3 -= $nilai_optimasi_1[$h]->penilaian[$i]->nilai_ternormalisasi_nilai;
}
}
$nilai_optimasi_1[$h]->optimasi_1 = $temp3;
}
$nilai_optimasi_2 = $matriks_nilai;
for ($h = 0; $h < count($nilai_optimasi_2); $h++) {
$min = 0;
$max = 0;
for ($i = 0; $i < count($matriks_nilai[$h]->penilaian); $i++) {
if ($matriks_nilai[$h]->penilaian[$i]->jenis == 'cost') {
$min += $matriks_nilai[$h]->penilaian[$i]->nilai_ternormalisasi_nilai;
} else {
$max += $matriks_nilai[$h]->penilaian[$i]->nilai_ternormalisasi_nilai;
}
}
if ($min != 0 && $max != 0) {
$matriks_nilai[$h]->optimasi_2 = $max / $min;
} elseif ($min == 0 && $max != 0) {
$matriks_nilai[$h]->optimasi_2 = $max;
} else {
$matriks_nilai[$h]->optimasi_2 = $min;
}
}
$arr_1 = array();
$arr_2 = array();
for ($j = 0; $j < count($nilai_optimasi_2); $j++) {
array_push($arr_1, $nilai_optimasi_2[$j]->optimasi_1);
array_push($arr_2, $nilai_optimasi_2[$j]->optimasi_2);
}
$rank_1 = array();
$ordered_1 = $arr_1;
rsort($ordered_1);
foreach ($arr_1 as $key => $value) {
foreach ($ordered_1 as $ordered_key => $ordered_value) {
if ($value === $ordered_value) {
$key = $ordered_key;
break;
}
}
array_push($rank_1, $key + 1);
}
$rank_2 = array();
$ordered_2 = $arr_2;
rsort($ordered_2);
foreach ($arr_2 as $key1 => $value1) {
foreach ($ordered_2 as $ordered_key1 => $ordered_value1) {
if ($value1 === $ordered_value1) {
$key1 = $ordered_key1;
break;
}
}
array_push($rank_2, $key1 + 1);
}
return view('rekomendasi', compact('kategori', 'dosen', 'no', 'kriteria', 'alternatif', 'dosen', 'pembagi', 'matriks', 'matriks_nilai', 'nilai_optimasi_1', 'nilai_optimasi_2', 'rank_1', 'rank_2'));
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*/
public function show(String $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id)
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
//
}
}

View File

@ -0,0 +1,105 @@
<?php
namespace App\Http\Controllers;
use App\Models\SeminarProposalTempat;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
class SeminarProposalTempatController extends Controller
{
/**
* Menampilkan daftar tempat seminar.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
}
/**
* Menampilkan form untuk membuat tempat seminar baru.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
}
/**
* Menyimpan tempat seminar yang baru dibuat.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$request->validate([
'kode' => 'required|unique:seminar_proposal_tempat',
'ruang' => 'required',
// 'kuota' => 'required|integer'
]);
SeminarProposalTempat::create($request->all());
return redirect('setting-sempro')->with('toast_success', 'Tempat Seminar Proposal Berhasil Ditambahkan..');
}
/**
* Menampilkan data tempat seminar tertentu.
*
* @param \App\Models\SeminarProposalTempat $tempat
* @return \Illuminate\Http\Response
*/
public function show(SeminarProposalTempat $tempat)
{
}
/**
* Menampilkan form untuk mengedit tempat seminar.
*
* @param \App\Models\SeminarProposalTempat $tempat
* @return \Illuminate\Http\Response
*/
public function edit(SeminarProposalTempat $tempat)
{
}
/**
* Mengupdate tempat seminar yang sudah ada.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
$request->validate([
'ruang' => 'required',
// 'kuota' => 'required|integer'
]);
$tempat = SeminarProposalTempat::findOrFail($id);
$tempat->update($request->all());
return redirect('setting-sempro')->with('toast_success', 'Perubahan Berhasil Disimpan.');
}
/**
* Menghapus tempat seminar.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
$tempat = SeminarProposalTempat::findOrFail($id);
$tempat->delete();
return redirect('setting-sempro')->with('toast_success', 'Tempat Seminar Proposal Berhasil Dihapus.');
}
}

View File

@ -0,0 +1,106 @@
<?php
namespace App\Http\Controllers;
use App\Models\SeminarProposalWaktu;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
class SeminarProposalWaktuController extends Controller
{
/**
* Menampilkan daftar waktu seminar.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
}
/**
* Menampilkan form untuk membuat waktu seminar baru.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
}
/**
* Menyimpan waktu seminar yang baru dibuat.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$request->validate([
'sesi' => 'required',
'waktu_mulai' => 'required|date_format:H:i',
'waktu_selesai' => 'required|date_format:H:i|after:waktu_mulai'
]);
SeminarProposalWaktu::create($request->all());
return redirect('setting-sempro')->with('toast_success', 'Waktu Seminar Proposal Berhasil Ditambahkan.');
}
/**
* Menampilkan data waktu seminar tertentu.
*
* @param \App\Models\SeminarProposalWaktu $waktu
* @return \Illuminate\Http\Response
*/
public function show(SeminarProposalWaktu $waktu)
{
}
/**
* Menampilkan form untuk mengedit waktu seminar.
*
* @param \App\Models\SeminarProposalWaktu $waktu
* @return \Illuminate\Http\Response
*/
public function edit(SeminarProposalWaktu $waktu)
{
}
/**
* Mengupdate waktu seminar yang sudah ada.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
$request->validate([
'sesi' => 'required',
'waktu_mulai' => 'required|date_format:H:i',
'waktu_selesai' => 'required|date_format:H:i|after:waktu_mulai'
]);
$waktu = SeminarProposalWaktu::findOrFail($id);
$waktu->update($request->all());
return redirect('setting-sempro')->with('toast_success', 'Perubahan Berhasil Disimpan.');
}
/**
* Menghapus waktu seminar.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
$waktu = SeminarProposalWaktu::findOrFail($id);
$waktu->delete();
return redirect('setting-sempro')->with('toast_success', 'Waktu Seminar Proposal Berhasil Dihapus.');
}
}

View File

@ -0,0 +1,465 @@
<?php
namespace App\Http\Controllers;
use App\Exports\SeminarProposalExport;
use App\Models\Pengajuan;
use App\Models\SeminarJadwal;
use App\Models\SeminarProposal;
use App\Models\SeminarProposalTempat;
use App\Models\SeminarProposalWaktu;
use App\Models\SettingSempro;
use App\Models\User;
use Carbon\Carbon;
use DateTime;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Maatwebsite\Excel\Facades\Excel;
use Barryvdh\DomPDF\Facade\Pdf as PDF;
class SemproController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index(Request $request)
{
if (Auth::User()->role == 'Admin') {
// Filter Tahun
$tahuns = SeminarJadwal::selectRaw('YEAR(tanggal_seminar) as year')->groupBy('year')->pluck('year');
$tahun = $request->tahun;
// Tangani filter tahun
$seminarJadwals = SeminarJadwal::whereIn(SeminarJadwal::raw('YEAR(tanggal_seminar)'), $tahuns)->when($tahun, function ($query, $tahun) {
return $query->whereYear('tanggal_seminar', $tahun);
});
// Filter Jadwal
$filter = $request->jadwal;
$today = Carbon::today();
// Tangani filter dropdown
if ($filter == 'hari') {
$seminarJadwals->whereDate('tanggal_seminar', $today);
} elseif ($filter == 'minggu') {
$startOfWeek = $today->startOfWeek();
$endOfWeek = $today->endOfWeek();
$seminarJadwals->whereBetween('tanggal_seminar', [$startOfWeek, $endOfWeek]);
} elseif ($filter == 'bulan') {
$seminarJadwals->whereYear('tanggal_seminar', $today->year)
->whereMonth('tanggal_seminar', $today->month);
}
// Dapatkan data seminar jadwal
$seminarJadwals = $seminarJadwals->get();
// Mengambil semua pengajuan
$pengajuans = Pengajuan::all();
// Mengambil semua mahasiswa
$mahasiswas = User::where('role', 'mahasiswa')->get();
// Mengambil semua dosen pembimbing
$dosenPembimbings = User::where('role', 'Dosen')->get();
// Mengambil semua seminar proposals
$seminarProposals = SeminarProposal::all();
// Mengambil semua tempat seminar proposal
$seminarProposalTempats = SeminarProposalTempat::all();
// Mengambil semua waktu seminar proposal
$seminarProposalWaktus = SeminarProposalWaktu::all();
// Memeriksa apakah ada jadwal
$showResetButton = $seminarJadwals->isNotEmpty();
return view('sempro', compact('tahuns', 'tahun', 'seminarJadwals', 'pengajuans', 'mahasiswas', 'dosenPembimbings', 'seminarProposals', 'seminarProposalTempats', 'seminarProposalWaktus', 'showResetButton'));
} elseif (Auth::user()->role == 'Dosen') {
$user_id = Auth::user()->id;
// Filter Tahun
$tahuns = SeminarJadwal::selectRaw('YEAR(tanggal_seminar) as year')->groupBy('year')->pluck('year');
$tahun = $request->tahun;
// Tangani filter tahun
$seminarJadwals = SeminarJadwal::where(function ($query) use ($user_id) {
$query->where('id_dosen_pembimbing', $user_id)
->orWhere('id_dosen_panelis_1', $user_id);
})
->whereIn(SeminarJadwal::raw('YEAR(tanggal_seminar)'), $tahuns)
->when($tahun, function ($query, $tahun) {
return $query->whereYear('tanggal_seminar', $tahun);
});
// Filter Jadwal
$filter = $request->jadwal;
$today = Carbon::today();
// Tangani filter dropdown
if ($filter == 'hari') {
$seminarJadwals->whereDate('tanggal_seminar', $today);
} elseif ($filter == 'minggu') {
$startOfWeek = $today->startOfWeek();
$endOfWeek = $today->endOfWeek();
$seminarJadwals->whereBetween('tanggal_seminar', [$startOfWeek, $endOfWeek]);
} elseif ($filter == 'bulan') {
$seminarJadwals->whereYear('tanggal_seminar', $today->year)
->whereMonth('tanggal_seminar', $today->month);
}
// Dapatkan data seminar jadwal
$seminarJadwals = $seminarJadwals->get();
return view('sempro', compact('seminarJadwals', 'tahun', 'tahuns'));
} elseif (Auth::user()->role == 'Mahasiswa') {
$user_id = Auth::user()->id;
$seminarJadwals = SeminarJadwal::where('id_mahasiswa', $user_id)
->get();
return view('sempro', compact('seminarJadwals'));
}
}
function generateJadwal($seminarProposal = null, $tglMulaiSidang = null, $waktuSeminarProposal = null, $tempatSeminarProposal = null)
{
// Ambil pengaturan seminar proposal
$settingSempro = SettingSempro::first();
// Ambil waktu mulai sidang
$tglMulaiSidang = ($tglMulaiSidang == null) ? $settingSempro->tgl_mulai_sidang : $tglMulaiSidang;
// Ambil tanggal akhir sidang
$tglAkhirSidang = $settingSempro->tgl_akhir_sidang;
// Ambil data seminar proposal yang belum terjadwal
$seminarProposalBelumTerjadwal = SeminarProposal::whereDoesntHave('seminarJadwal')->get();
$semproToBeAssigned = [];
/** @var SeminarProposal $pengajuanSeminarProposal */
foreach ($seminarProposalBelumTerjadwal as $pengajuanSeminarProposal) {
/** @var Pengajuan $pengajuan */
$pengajuan = $pengajuanSeminarProposal->pengajuan;
/** @var User $dosenPembimbing */
$dosenPembimbing = $pengajuan->dosenPembimbing;
$listPengajuan = $semproToBeAssigned[$dosenPembimbing->getAuthIdentifier()] ?? [];
$listPengajuan[] = $pengajuanSeminarProposal;
$semproToBeAssigned[$dosenPembimbing->getAuthIdentifier()] = $listPengajuan;
}
$listIdDosen = array_keys($semproToBeAssigned);
while ($semproToBeAssigned != []) {
$arrayKeys = array_keys($semproToBeAssigned);
$idDosenTimA = $arrayKeys[0] ?? null;
/** @var SeminarProposal $timA */
$timA = $semproToBeAssigned[$idDosenTimA] ?? null;
$idDosenTimB = $arrayKeys[1] ?? null;
/** @var SeminarProposal $timB */
$timB = $semproToBeAssigned[$idDosenTimB] ?? null;
$daftarTim = [];
if ($idDosenTimA != null) {
$daftarTim[$idDosenTimA] = $timA;
}
if ($idDosenTimB != null) {
$daftarTim[$idDosenTimB] = $timB;
}
if (count($daftarTim) < 2) {
$dosen = User::query()->where('role', 'Dosen')->where('prodi', 'MIF')->whereNot('id', $idDosenTimA)->inRandomOrder()->first();
$daftarTim[$dosen->id] = [];
}
[$sisaTimA, $sisaTimB] = $this->generateJadwalService($daftarTim, $tglMulaiSidang, $tglAkhirSidang);
if ($sisaTimA != null && count($sisaTimA) != 0) {
$semproToBeAssigned[$idDosenTimA] = $sisaTimA;
} else {
unset($semproToBeAssigned[$idDosenTimA]);
}
if ( $sisaTimB != null && count($sisaTimB) != 0) {
$semproToBeAssigned[$idDosenTimB] = $sisaTimB;
} else {
unset($semproToBeAssigned[$idDosenTimB]);
}
}
return redirect()->back()->with('toast_success', 'Generate Jadwal Seminar Proposal Berhasil.');
}
public function generateJadwalService(
$teamToBeAssigned = null,
$tglMulaiSidang = null,
$tglAkhirSidang = null,
$waktuSeminarProposal = null,
$tempatSeminarProposal = null
) {
// Konversi tanggal menjadi objek Carbon
$tglMulaiSidang = Carbon::parse($tglMulaiSidang);
// Jika tanggal tersebut adalah hari Sabtu atau Minggu, geser ke hari Senin
if ($tglMulaiSidang->isWeekend()) {
$tglMulaiSidang->next(Carbon::MONDAY);
}
// Periksa apakah tanggal mulai sidang melewati tanggal akhir sidang
if (Carbon::parse($tglMulaiSidang)->gt(Carbon::parse($tglAkhirSidang))) {
// Jika tanggal mulai sidang melewati tanggal akhir sidang, generate gagal
return redirect()
->back()
->with(
'toast_error',
'Generate Jadwal Melewati Batas Akhir. Tambahkan Tempat/Waktu Seminar Proposal.'
);
}
$arrayKeys = array_keys($teamToBeAssigned);
$idDosenTimA = $arrayKeys[0];
/** @var SeminarProposal $timA */
$timA = $teamToBeAssigned[$idDosenTimA];
$idDosenTimB = $arrayKeys[1];
/** @var SeminarProposal $timB */
$timB = $teamToBeAssigned[$idDosenTimB];
$waktuSeminarProposal = ($waktuSeminarProposal == null)
? SeminarProposalWaktu::query()->orderBy('waktu_mulai')->first()
: $waktuSeminarProposal;
$tempatSeminarProposal = ($tempatSeminarProposal == null)
? SeminarProposalTempat::query()->orderBy('id')->first()
: $tempatSeminarProposal;
// Ambil data jadwal seminar yang sudah ada pada tanggal dan waktu yang sama
$cekDosenSudahTerjadwal = SeminarJadwal::query()
->where('tanggal_seminar', $tglMulaiSidang)
->where('id_seminar_proposal_waktu', $waktuSeminarProposal->id)
->where(function (Builder $query) use ($idDosenTimA, $idDosenTimB) {
$query->where('id_dosen_pembimbing', $idDosenTimA)
->orWhere('id_dosen_panelis_1', $idDosenTimA)
->orWhere('id_dosen_pembimbing', $idDosenTimB)
->orWhere('id_dosen_panelis_1', $idDosenTimB);
})->count();
if ($cekDosenSudahTerjadwal == 0) {
$cekApaRuanganTidakKosong = SeminarJadwal::query()
->where('tanggal_seminar', $tglMulaiSidang)
->where('id_seminar_proposal_waktu', $waktuSeminarProposal->id)
->where('id_seminar_proposal_tempat', $tempatSeminarProposal->id)
->count();
// 0 artinya ruangan kosong
if ($cekApaRuanganTidakKosong == 0) {
$jumlahTimAAwal = count($timA);
for ($i = 0; $i < $jumlahTimAAwal && $i < 3; $i++) {
$mahasiswa = $timA[$i]->mahasiswa;
$pengajuan = $timA[$i]->pengajuan;
$dosenPembimbing = $idDosenTimA;
$dosenPenguji = $idDosenTimB;
$seminarJadwal = new SeminarJadwal;
$seminarJadwal->id_pengajuan = $pengajuan->id;
$seminarJadwal->id_mahasiswa = $mahasiswa->id;
$seminarJadwal->id_dosen_pembimbing = $dosenPembimbing;
$seminarJadwal->id_dosen_panelis_1 = $dosenPenguji;
$seminarJadwal->id_seminar_proposal = $timA[$i]->id;
$seminarJadwal->id_seminar_proposal_waktu = $waktuSeminarProposal->id;
$seminarJadwal->id_seminar_proposal_tempat = $tempatSeminarProposal->id;
$seminarJadwal->tanggal_seminar = $tglMulaiSidang;
$seminarJadwal->save();
unset($timA[$i]);
}
$jumlahTimBAwal = count($timB);
for ($i = 0; $i < $jumlahTimBAwal && $i < 3; $i++) {
$mahasiswa = $timB[$i]->mahasiswa;
$pengajuan = $timB[$i]->pengajuan;
$dosenPembimbing = $idDosenTimB;
$dosenPenguji = $idDosenTimA;
$seminarJadwal = new SeminarJadwal;
$seminarJadwal->id_pengajuan = $pengajuan->id;
$seminarJadwal->id_mahasiswa = $mahasiswa->id;
$seminarJadwal->id_dosen_pembimbing = $dosenPembimbing;
$seminarJadwal->id_dosen_panelis_1 = $dosenPenguji;
$seminarJadwal->id_seminar_proposal = $timB[$i]->id;
$seminarJadwal->id_seminar_proposal_waktu = $waktuSeminarProposal->id;
$seminarJadwal->id_seminar_proposal_tempat = $tempatSeminarProposal->id;
$seminarJadwal->tanggal_seminar = $tglMulaiSidang;
$seminarJadwal->save();
unset($timB[$i]);
}
if (count($timA) != 0 && count($timB) != 0) {
$waktuSeminarProposalBerikutnya = SeminarProposalWaktu::where('waktu_mulai', '>', $waktuSeminarProposal->waktu_mulai)->first();
$sisaData = [
$idDosenTimA => [...$timA],
$idDosenTimB => [...$timB],
];
if ($waktuSeminarProposalBerikutnya == null) {
$tglMulaiSidangObj = new DateTime($tglMulaiSidang->format('Y-m-d'));
$tglMulaiSidangObj->modify('+1 day');
$tglMulaiSidang = $tglMulaiSidangObj;
// Konversi tanggal menjadi objek Carbon
$tglMulaiSidang = Carbon::parse($tglMulaiSidang);
// Jika tanggal tersebut adalah hari Sabtu atau Minggu, geser ke hari Senin
if ($tglMulaiSidang->isWeekend()) {
$tglMulaiSidang->next(Carbon::MONDAY);
}
return $this->generateJadwalService($sisaData, $tglMulaiSidang, $tglAkhirSidang);
} else {
return $this->generateJadwalService($sisaData, $tglMulaiSidang, $tglAkhirSidang, $waktuSeminarProposalBerikutnya);
}
} else {
return [$timA, $timB];
}
} else {
$tempatSeminarProposalBerikutnya = SeminarProposalTempat::where('id', '>', $tempatSeminarProposal->id)->first();
$sisaData = [
$idDosenTimA => [...$timA],
$idDosenTimB => [...$timB],
];
if ($tempatSeminarProposalBerikutnya == null) {
$waktuSeminarProposalBerikutnya = SeminarProposalWaktu::where('waktu_mulai', '>', $waktuSeminarProposal->waktu_mulai)->first();
if ($waktuSeminarProposalBerikutnya == null) {
$tglMulaiSidangObj = new DateTime($tglMulaiSidang);
$tglMulaiSidangObj->modify('+1 day');
$tglMulaiSidang = $tglMulaiSidangObj;
// Konversi tanggal menjadi objek Carbon
$tglMulaiSidang = Carbon::parse($tglMulaiSidang);
// Jika tanggal tersebut adalah hari Sabtu atau Minggu, geser ke hari Senin
if ($tglMulaiSidang->isWeekend()) {
$tglMulaiSidang->next(Carbon::MONDAY);
}
return $this->generateJadwalService($sisaData, $tglMulaiSidang, $tglAkhirSidang);
} else {
return $this->generateJadwalService($sisaData, $tglMulaiSidang, $tglAkhirSidang, $waktuSeminarProposalBerikutnya);
}
} else {
return $this->generateJadwalService($sisaData, $tglMulaiSidang, $tglAkhirSidang, $waktuSeminarProposal, $tempatSeminarProposalBerikutnya);
}
}
} else {
$waktuSeminarProposalBerikutnya = SeminarProposalWaktu::where('waktu_mulai', '>', $waktuSeminarProposal->waktu_mulai)->first();
$sisaData = [
$idDosenTimA => [...$timA],
$idDosenTimB => [...$timB],
];
if ($waktuSeminarProposalBerikutnya == null) {
$tglMulaiSidangObj = new DateTime($tglMulaiSidang);
$tglMulaiSidangObj->modify('+1 day');
$tglMulaiSidang = $tglMulaiSidangObj;
// Konversi tanggal menjadi objek Carbon
$tglMulaiSidang = Carbon::parse($tglMulaiSidang);
// Jika tanggal tersebut adalah hari Sabtu atau Minggu, geser ke hari Senin
if ($tglMulaiSidang->isWeekend()) {
$tglMulaiSidang->next(Carbon::MONDAY);
}
return $this->generateJadwalService($sisaData, $tglMulaiSidang, $tglAkhirSidang);
} else {
return $this->generateJadwalService($sisaData, $tglMulaiSidang, $tglAkhirSidang, $waktuSeminarProposalBerikutnya);
}
}
return [$sisaTimA, $sisaTimB];
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
// Validasi data yang diterima dari request
$request->validate([]);
// Cari data SeminarJadwal berdasarkan ID
$jadwal = SeminarJadwal::findOrFail($id);
if($request->id_dosen_panelis_1 == $jadwal->id_dosen_pembimbing)
{
return redirect()->back()->with('toast_error', 'Dosen Penguji Sama Dengan Dosen Pembimbing.');
} else {
// Update data SeminarJadwal dengan data baru dari request
$jadwal->update([
'id_seminar_proposal_waktu' => $request->input('id_seminar_proposal_waktu'),
'id_seminar_proposal_tempat' => $request->input('id_seminar_proposal_tempat'),
'tanggal_seminar' => $request->input('tanggal_seminar'),
'id_dosen_panelis_1' => $request->input('id_dosen_panelis_1'),
]);
// Redirect ke halaman atau route yang sesuai setelah berhasil mengupdate data
return redirect()->back()->with('toast_success', 'Jadwal Seminar Proposal Berhasil Diperbarui.');
}
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
// Cari data SeminarJadwal berdasarkan ID
$jadwal = SeminarJadwal::findOrFail($id);
// Hapus data SeminarJadwal
$jadwal->delete();
// Redirect ke halaman atau route yang sesuai setelah berhasil menghapus data
return redirect()->back()->with('toast_success', 'Jadwal Seminar Proposal Berhasil Dihapus.');
}
public function reset()
{
// Menghapus semua jadwal
SeminarJadwal::truncate();
return redirect()->back()->with('toast_success', 'Jadwal Seminar Proposal Berhasil Diatur Ulang.');
}
public function exportExcel()
{
return Excel::download(new SeminarProposalExport, 'seminarproposal.xlsx');
}
public function exportPDF()
{
$seminarJadwal = SeminarJadwal::with([
'pengajuan',
'mahasiswa',
'dosenPembimbing',
'dosenPanelis1',
'seminarProposal',
'seminarProposalWaktu',
'seminarProposalTempat'
])->get();
$pdf = PDF::loadView('export.seminarproposal', compact('seminarJadwal'))->setPaper('a4', 'landscape');
return $pdf->stream();
}
}

View File

@ -0,0 +1,74 @@
<?php
namespace App\Http\Controllers;
use App\Models\SettingPengajuan;
use Illuminate\Http\Request;
class SettingPengajuanController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
$dataExists = SettingPengajuan::exists();
$data = $dataExists ? SettingPengajuan::first() : null;
return view('setting-pengajuan', compact('dataExists', 'data'));
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
$request->validate([
'tglMulai' => 'required',
'tglSelesai' => 'required',
'maxPembimbing' => 'required',
'maxMahasiswa' => 'required',
]);
SettingPengajuan::create($request->all());
return redirect('setting-pengajuan')->with('toast_success', 'Pengaturan Pengajuan Berhasil Ditambahkan.');
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id)
{
$request->validate([
'tglMulai' => 'required',
'tglSelesai' => 'required',
'maxPembimbing' => 'required',
'maxMahasiswa' => 'required',
]);
$setPengajuan = SettingPengajuan::find($id);
$setPengajuan->update($request->all());
return redirect('setting-pengajuan')->with('toast_success', 'Perubahan Berhasil Disimpan.');
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
$setPengajuan = SettingPengajuan::find($id);
$setPengajuan->delete();
return redirect('setting-pengajuan')->with('toast_success', 'Pengaturan Pengajuan Berhasil Dihapus.');
}
}

View File

@ -0,0 +1,71 @@
<?php
namespace App\Http\Controllers;
use App\Models\SeminarProposalTempat;
use App\Models\SeminarProposalWaktu;
use App\Models\SettingSempro;
use Illuminate\Http\Request;
class SettingSemproController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
$tempat = SeminarProposalTempat::all();
$waktu = SeminarProposalWaktu::all();
$dataExists = SettingSempro::exists();
$data = $dataExists ? SettingSempro::first() : null;
return view('setting-sempro', compact('tempat', 'waktu', 'dataExists', 'data'));
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
$request->validate([
'tgl_mulai_pendaftaran' => 'required|date',
'tgl_selesai_pendaftaran' => 'required|date|after_or_equal:tgl_mulai_pendaftaran',
'tgl_mulai_sidang' => 'required|date|after_or_equal:tgl_selesai_pendaftaran',
'tgl_akhir_sidang' => 'required|date',
]);
SettingSempro::create($request->all());
return redirect()->back()->with('toast_success', 'Pengaturan Seminar Proposal Berhasil Ditambahkan.');
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
$request->validate([
'tgl_mulai_pendaftaran' => 'required|date',
'tgl_selesai_pendaftaran' => 'required|date|after_or_equal:tgl_mulai_pendaftaran',
'tgl_mulai_sidang' => 'required|date|after_or_equal:tgl_selesai_pendaftaran',
'tgl_akhir_sidang' => 'required|date',
]);
$settingSempro = SettingSempro::findOrFail($id);
$settingSempro->update($request->all());
return redirect()->back()->with('toast_success', 'Perubahan Berhasil Disimpan.');
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
$settingSempro = SettingSempro::findOrFail($id);
$settingSempro->delete();
return redirect()->back()->with('toast_success', 'Pengaturan Seminar Proposal Berhasil Dihapus.');
}
}

View File

@ -0,0 +1,76 @@
<?php
namespace App\Http\Controllers;
use App\Models\SettingSidang;
use App\Models\SidangTempat;
use App\Models\SidangWaktu;
use Illuminate\Http\Request;
class SettingSidangController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
$tempat = SidangTempat::all();
$waktu = SidangWaktu::all();
$dataExists = SettingSidang::exists();
$data = $dataExists ? SettingSidang::first() : null;
return view('setting-sidang', compact('tempat', 'waktu', 'dataExists', 'data'));
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
$request->validate([
'tgl_mulai_pendaftaran' => 'required|date',
'tgl_selesai_pendaftaran' => 'required|date|after_or_equal:tgl_mulai_pendaftaran',
'tgl_mulai_sidang' => 'required|date|after_or_equal:tgl_selesai_pendaftaran',
'tgl_akhir_sidang' => 'required|date',
]);
SettingSidang::create($request->all());
return redirect()->back()->with('toast_success', 'Pengaturan Sidang Berhasil Ditambahkan.');
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
$request->validate([
'tgl_mulai_pendaftaran' => 'required|date',
'tgl_selesai_pendaftaran' => 'required|date|after_or_equal:tgl_mulai_pendaftaran',
'tgl_mulai_sidang' => 'required|date|after_or_equal:tgl_selesai_pendaftaran',
'tgl_akhir_sidang' => 'required|date',
]);
$settingSempro = SettingSidang::findOrFail($id);
$settingSempro->update($request->all());
return redirect()->back()->with('toast_success', 'Perubahan Berhasil Disimpan.');
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
//
}
}

View File

@ -0,0 +1,551 @@
<?php
namespace App\Http\Controllers;
use App\Exports\SidangExport;
use App\Models\Pengajuan;
use App\Models\SeminarJadwal;
use App\Models\SettingSidang;
use App\Models\Sidang;
use App\Models\SidangJadwal;
use App\Models\SidangTempat;
use App\Models\SidangWaktu;
use App\Models\User;
use Carbon\Carbon;
use DateTime;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;
use Maatwebsite\Excel\Facades\Excel;
use Barryvdh\DomPDF\Facade\Pdf as PDF;
class SidangController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index(Request $request)
{
if (Auth::User()->role == 'Admin') {
// Filter Tahun
$tahuns = SidangJadwal::selectRaw('YEAR(tanggal_sidang) as year')->groupBy('year')->pluck('year');
$tahun = $request->tahun;
// Filter Jadwal
$filter = $request->jadwal;
$today = Carbon::today();
// Tangani filter tahun
$sidangJadwals = SidangJadwal::whereIn(SidangJadwal::raw('YEAR(tanggal_sidang)'), $tahuns)->when($tahun, function ($query, $tahun) {
return $query->whereYear('tanggal_sidang', $tahun);
});
// Tangani filter dropdown
if ($filter == 'hari') {
$sidangJadwals->whereDate('tanggal_sidang', $today);
} elseif ($filter == 'minggu') {
$startOfWeek = $today->startOfWeek();
$endOfWeek = $today->endOfWeek();
$sidangJadwals->whereBetween('tanggal_sidang', [$startOfWeek, $endOfWeek]);
} elseif ($filter == 'bulan') {
$sidangJadwals->whereYear('tanggal_sidang', $today->year)
->whereMonth('tanggal_sidang', $today->month);
}
// Dapatkan data sidang jadwal
$sidangJadwals = $sidangJadwals->get();
$pengajuans = Pengajuan::all();
$mahasiswas = User::where('role', 'mahasiswa')->get();
$dosenPembimbings = User::where('role', 'Dosen')->get();
$sidangs = Sidang::all();
$sidangTempats = SidangTempat::all();
$sidangWaktus = SidangWaktu::all();
$showResetButton = $sidangJadwals->isNotEmpty();
return view('sidang', compact('tahun', 'tahuns', 'sidangJadwals', 'pengajuans', 'mahasiswas', 'dosenPembimbings', 'sidangs', 'sidangTempats', 'sidangWaktus', 'showResetButton'));
} elseif (Auth::user()->role == 'Dosen') {
$user_id = Auth::user()->id;
// Filter Tahun
$tahuns = SidangJadwal::selectRaw('YEAR(tanggal_sidang) as year')->groupBy('year')->pluck('year');
$tahun = $request->tahun;
// Filter Jadwal
$filter = $request->jadwal;
$today = Carbon::today();
// Tangani filter tahun
$sidangJadwals = SidangJadwal::where(function ($query) use ($user_id) {
$query->where('id_dosen_pembimbing', $user_id)
->orWhere('id_dosen_panelis_1', $user_id)
->orWhere('id_dosen_panelis_2', $user_id);
})
->whereIn(SidangJadwal::raw('YEAR(tanggal_sidang)'), $tahuns)
->when($tahun, function ($query, $tahun) {
return $query->whereYear('tanggal_sidang', $tahun);
});
// Tangani filter dropdown
if ($filter == 'hari') {
$sidangJadwals->whereDate('tanggal_sidang', $today);
} elseif ($filter == 'minggu') {
$startOfWeek = $today->startOfWeek();
$endOfWeek = $today->endOfWeek();
$sidangJadwals->whereBetween('tanggal_sidang', [$startOfWeek, $endOfWeek]);
} elseif ($filter == 'bulan') {
$sidangJadwals->whereYear('tanggal_sidang', $today->year)
->whereMonth('tanggal_sidang', $today->month);
}
// Dapatkan data sidang jadwal
$sidangJadwals = $sidangJadwals->get();
return view('sidang', compact('tahun', 'tahuns', 'sidangJadwals'));
} elseif (Auth::user()->role == 'Mahasiswa') {
$user_id = Auth::user()->id;
$sidangJadwals = SidangJadwal::where('id_mahasiswa', $user_id)
->get();
return view('sidang', compact('sidangJadwals'));
}
return view('sidang');
}
function generateJadwal(Request $request, $sidang = null, $tglMulaiSidang = null, $waktuSidang = null, $tempatSidang = null)
{
// Ambil pengaturan seminar proposal
$settingSidang = SettingSidang::first();
// Ambil waktu mulai sidang
$tglMulaiSidang = ($tglMulaiSidang == null) ? $settingSidang->tgl_mulai_sidang : $tglMulaiSidang;
// Ambil tanggal akhir sidang
$tglAkhirSidang = $settingSidang->tgl_akhir_sidang;
// Ambil data seminar proposal yang belum terjadwal
$sidangBelumTerjadwal = Sidang::whereDoesntHave('sidangJadwal')->get();
// Lakukan looping untuk setiap seminar proposal yang belum terjadwal
foreach ($sidangBelumTerjadwal as $sidang) {
// Ambil data mahasiswa, pengajuan, dan dosen pembimbing
$mahasiswa = $sidang->mahasiswa;
$pengajuan = $sidang->pengajuan;
$dosenPembimbing = $pengajuan->dosenPembimbing;
// Lakukan looping untuk menentukan waktu, tempat, dan tanggal yang tersedia
do {
// Ambil data waktu seminar proposal
$waktuSidang = ($waktuSidang == null) ? SidangWaktu::orderBy('waktu_mulai')->first() : $waktuSidang;
// Ambil data tempat seminar proposal
$tempatSidang = ($tempatSidang == null) ? SidangTempat::inRandomOrder()->first() : $tempatSidang;
// Cek apakah dosen panelis 1 atau dosen pembimbing sudah memiliki jadwal pada waktu dan tempat yang sama
$dosenTerpakai = SidangJadwal::where('tanggal_sidang', $tglMulaiSidang)
->where('id_sidang_waktu', $waktuSidang->id)
->where(function ($query) use ($dosenPembimbing) {
$query->where('id_dosen_panelis_1', $dosenPembimbing->id)
->orWhere('id_dosen_pembimbing', $dosenPembimbing->id);
})
->exists();
// Cek apakah waktu, tempat, dan tanggal yang sama sudah digunakan untuk sidang yang berbeda
$waktuTempatTerpakai = SidangJadwal::where('tanggal_sidang', $tglMulaiSidang)
->where('id_sidang_waktu', $waktuSidang->id)
->where('id_sidang_tempat', $tempatSidang->id)
->exists();
// Jika dosen atau waktu-tempat sudah terpakai, pindah ke tempat atau waktu berikutnya
if ($dosenTerpakai || $waktuTempatTerpakai) {
// Cek apakah masih ada tempat yang tersedia pada waktu yang sama
$nextTempatSidang = SidangTempat::where('id', '>', $tempatSidang->id)
->inRandomOrder()
->first();
if (!$nextTempatSidang) {
// Jika tidak ada tempat tersedia, pindah ke waktu berikutnya
$nextWaktuSidang = SidangWaktu::where('waktu_mulai', '>', $waktuSidang->waktu_mulai)
->whereNotExists(function ($query) use ($tglMulaiSidang, $tempatSidang) {
$query->select(DB::raw(1))
->from('sidang_jadwal')
->whereRaw('sidang_jadwal.tanggal_sidang = ?', [$tglMulaiSidang])
->whereRaw('sidang_jadwal.id_sidang_tempat = ?', [$tempatSidang->id])
->whereRaw('sidang_jadwal.id_sidang_waktu = sidang_waktu.id');
})
->first();
if (!$nextWaktuSidang) {
// Jika tidak ada waktu berikutnya, lanjutkan ke hari berikutnya
$tglMulaiSidangObj = new DateTime($tglMulaiSidang); // Konversi string menjadi objek DateTime
$tglMulaiSidangObj->modify('+1 day'); // Tambah 1 hari
// $tglMulaiSidang = $tglMulaiSidangObj;
$tglMulaiSidang = $tglMulaiSidangObj->format('Y-m-d');
// Konversi tanggal menjadi objek Carbon
$tglMulaiSidang = Carbon::parse($tglMulaiSidang);
// Jika tanggal tersebut adalah hari Sabtu atau Minggu, geser ke hari Senin
if ($tglMulaiSidang->isWeekend()) {
$tglMulaiSidang->next(Carbon::MONDAY);
}
// Periksa apakah tanggal mulai sidang melewati tanggal akhir sidang
if (Carbon::parse($tglMulaiSidang)->gt(Carbon::parse($tglAkhirSidang))) {
// Jika tanggal mulai sidang melewati tanggal akhir sidang, generate gagal
return redirect()
->back()
->with(
'toast_error',
'Generate Jadwal Melewati Batas Akhir. Tambahkan Tempat/Waktu Seminar Proposal.'
);
}
$waktuSidang = null;
$tempatSidang = null;
} else {
// Jika masih ada waktu berikutnya, lanjutkan ke waktu tersebut
$waktuSidang = $nextWaktuSidang;
$tempatSidang = null;
}
} else {
// Jika masih ada tempat berikutnya, lanjutkan ke tempat tersebut
$tempatSidang = $nextTempatSidang;
}
}
} while ($dosenTerpakai || $waktuTempatTerpakai);
// Buat data seminar jadwal
$id_dosen_panelis_1 = SeminarJadwal::where('id_seminar_proposal', $sidang->seminarProposal->id)
->value('id_dosen_panelis_1');
$sidangJadwal = new SidangJadwal();
$sidangJadwal->id_pengajuan = $pengajuan->id;
$sidangJadwal->id_mahasiswa = $mahasiswa->id;
$sidangJadwal->id_dosen_pembimbing = $dosenPembimbing->id;
$sidangJadwal->id_dosen_panelis_1 = $id_dosen_panelis_1;
$sidangJadwal->id_seminar_proposal = $sidang->seminarProposal->id;
$sidangJadwal->id_sidang = $sidang->id;
$sidangJadwal->id_sidang_waktu = $waktuSidang->id;
$sidangJadwal->id_sidang_tempat = $tempatSidang->id;
$sidangJadwal->tanggal_sidang = $tglMulaiSidang;
$sidangJadwal->save();
}
$sidangJadwalBelumLengkap = SidangJadwal::whereNull('id_dosen_panelis_2')->get();
foreach ($sidangJadwalBelumLengkap as $jadwal) {
// Cari id (dosen) dari users where role Dosen
$dosen = User::where('role', 'Dosen')->where('prodi', $request->input('prodi'))->pluck('id')->toArray();
// Acak urutan elemen dalam array $dosen
shuffle($dosen);
$dosenPanelis2 = null;
// Iterasi semua dosen pastikan memenuhi kondisi 1 dan 2
foreach ($dosen as $idDosen) {
// Kondisi 1: pastikan belum menjadi id_dosen_pembimbing pada id_sidang_waktu dan seminar_tanggal yang sama
$belumJadiDosenPembimbing = SidangJadwal::where('id_sidang_waktu', $jadwal->id_sidang_waktu)
->where('tanggal_sidang', $jadwal->tanggal_sidang)
->where('id_dosen_pembimbing', $idDosen)
->doesntExist();
// Kondisi 2: pastikan belum menjadi id_dosen_panelis_2 pada id_sidang_waktu dan seminar_tanggal yang sama
$belumJadiDosenPanelis1 = SidangJadwal::where('id_sidang_waktu', $jadwal->id_sidang_waktu)
->where('tanggal_sidang', $jadwal->tanggal_sidang)
->where('id_dosen_panelis_1', $idDosen)
->doesntExist();
// Kondisi 3: pastikan belum menjadi id_dosen_panelis_2 pada id_sidang_waktu dan seminar_tanggal yang sama
$belumJadiDosenPanelis2 = SidangJadwal::where('id_sidang_waktu', $jadwal->id_sidang_waktu)
->where('tanggal_sidang', $jadwal->tanggal_sidang)
->where('id_dosen_panelis_2', $idDosen)
->doesntExist();
// Sesuai prodi dosen
$sesuaiProdi = User::where('role', 'Dosen')->where('prodi', $request->input('prodi'))->exists();
// Menghitung jumlah panelis yang sudah ada
$jumlahPanelis = SidangJadwal::where('id_dosen_panelis_2', $idDosen)->count();
// Batasan maksimal panelis
$batasanPanelis = $request->input('limit');
// Jika dosen memenuhi semua kondisi, kita jadikan sebagai dosen panelis 2
if ($belumJadiDosenPembimbing && $belumJadiDosenPanelis1 && $belumJadiDosenPanelis2 && $sesuaiProdi && $jumlahPanelis < $batasanPanelis) {
$dosenPanelis2 = $idDosen;
break; // Keluar dari perulangan jika sudah ditemukan dosen
}
}
if (is_null($dosenPanelis2)) {
// Ambil dosen dari tabel User untuk dijadikan panelis 2 jika belum ditemukan dosen yang memenuhi kondisi
$prodi = $request->input('prodi');
$dosenPanelis2 = User::where('role', 'Dosen')
->whereIn('prodi', $prodi)
->whereNotIn('id', $dosen)
->inRandomOrder()
->first();
if ($dosenPanelis2) {
$dosenPanelis2 = $dosenPanelis2->id;
// Menghitung jumlah panelis yang sudah ada setelah memilih dosen secara acak
$jumlahPanelis = SidangJadwal::where('id_dosen_panelis_2', $dosenPanelis2)->count();
// Jika jumlah panelis melebihi batasan setelah memilih dosen secara acak, kembalikan pesan error
if ($jumlahPanelis > $batasanPanelis) {
return redirect()->back()->with('toast_error', 'Dosen Telah Mencapai Batas Maksimal Sebagai Anggota Penguji');
}
} else {
return redirect()->back()->with('toast_error', 'Seluruh Dosen Telah Mencapai Batas Maksimal Sebagai Anggota Penguji');
}
}
// Simpan id dosen panelis 2 ke dalam jadwal sidang
$jadwal->id_dosen_panelis_2 = $dosenPanelis2;
$jadwal->save();
}
return redirect('sidang')->with('toast_success', 'Generate Jadwal Sidang Berhasil.');
}
function generateJadwalV2($sidang = null, $tglMulaiSidang = null, $waktuSidang = null, $tempatSidang = null)
{
// Ambil pengaturan seminar proposal
$settingSidang = SettingSidang::first();
// Ambil waktu mulai sidang
$tglMulaiSidang = ($tglMulaiSidang == null) ? $settingSidang->tgl_mulai_sidang : $tglMulaiSidang;
// Ambil data seminar proposal yang belum terjadwal
$sidangBelumTerjadwal = Sidang::whereDoesntHave('sidangJadwal')->get();
// Lakukan looping untuk setiap seminar proposal
foreach ($sidangBelumTerjadwal as $sidang) {
// Ambil data mahasiswa, pengajuan, dan dosen pembimbing
$mahasiswa = $sidang->mahasiswa;
$pengajuan = $sidang->pengajuan;
$dosenPembimbing = $pengajuan->dosenPembimbing;
// Ambil data waktu seminar proposal
$waktuSidang = ($waktuSidang == null) ? SidangWaktu::orderBy('waktu_mulai')->first() : $waktuSidang;
// Ambil data tempat seminar proposal
$tempatSidang = ($tempatSidang == null) ? SidangTempat::first() : $tempatSidang;
// Ambil data jadwal seminar yang sudah ada pada tanggal dan waktu yang sama
$jadwalSeminarTersedia = SidangJadwal::where('tanggal_sidang', $tglMulaiSidang)
->where('id_sidang_waktu', $waktuSidang->id)
->where('id_sidang_tempat', $tempatSidang->id)
->get();
// Hitung jumlah dosen pembimbing yang sudah terjadwal pada tanggal dan waktu yang sama
$jumlahDosenPembimbingTerjadwal = 0;
foreach ($jadwalSeminarTersedia as $jadwal) {
if ($jadwal->id_dosen_pembimbing != $dosenPembimbing->id) {
$jumlahDosenPembimbingTerjadwal++;
}
}
// Jika masih ada kuota dosen pembimbing, jadwalkan seminar proposal
if ($jumlahDosenPembimbingTerjadwal < 2) {
// Buat data seminar jadwal
$id_dosen_panelis_1 = SeminarJadwal::where('id_seminar_proposal', $sidang->seminarProposal->id)
->value('id_dosen_panelis_1');
$sidangJadwal = new SidangJadwal();
$sidangJadwal->id_pengajuan = $pengajuan->id;
$sidangJadwal->id_mahasiswa = $mahasiswa->id;
$sidangJadwal->id_dosen_pembimbing = $dosenPembimbing->id;
$sidangJadwal->id_dosen_panelis_1 = $id_dosen_panelis_1;
$sidangJadwal->id_seminar_proposal = $sidang->seminarProposal->id;
$sidangJadwal->id_sidang = $sidang->id;
$sidangJadwal->id_sidang_waktu = $waktuSidang->id;
$sidangJadwal->id_sidang_tempat = $tempatSidang->id;
$sidangJadwal->tanggal_sidang = $tglMulaiSidang;
$sidangJadwal->save();
} else {
// If dosen pembimbing quota is full, check for empty slots in the current waktuSeminarProposal
$tempatSidangBerikutnya = SidangTempat::where('id', '>', $tempatSidang->id)->first();
$emptySlotsInCurrentWaktu = SidangJadwal::where('tanggal_sidang', $tglMulaiSidang)
->where('id_sidang_waktu', $waktuSidang->id)
->where('id_sidang_tempat', $tempatSidangBerikutnya->id)
->whereHas('dosenPembimbing', function ($query) {
$query->havingRaw('COUNT(*) < 5');
})
->count();
if ($emptySlotsInCurrentWaktu < 1) {
// If empty slots are found, schedule the seminar proposal in one of those slots
// ... (logic to schedule in an empty slot within the current waktuSeminarProposal)
// echo "Passing 0 ({$emptySlotsInCurrentWaktu}) - {$tglMulaiSidang} - {$waktuSidang} - {$tempatSidangBerikutnya}";
// exit();
$this->generateJadwal($sidang, $tglMulaiSidang, $waktuSidang, $tempatSidangBerikutnya);
} else {
// Jika kuota dosen pembimbing penuh, pindahkan ke sesi berikutnya
$waktuSidangBerikutnya = SidangWaktu::where('waktu_mulai', '>', $waktuSidang->waktu_mulai)->first();
if ($waktuSidangBerikutnya) {
// Ulangi proses penjadwalan dengan waktu seminar proposal berikutnya
// echo "Passing 1 ({$emptySlotsInCurrentWaktu}) - {$tglMulaiSidang} - {$waktuSidangBerikutnya} - {$tempatSidang}";
// exit();
$this->generateJadwal($sidang, $tglMulaiSidang, $waktuSidangBerikutnya, $tempatSidang);
// $this->generateJadwal($sidang, $tglMulaiSidang, $waktuSidangBerikutnya, $tempatSidang);
} else {
// Jika tidak ada waktu seminar proposal berikutnya, pindahkan ke hari berikutnya
$tglMulaiSidang = $tglMulaiSidang->addDays(1);
// Ulangi proses penjadwalan dengan tanggal seminar dan waktu seminar proposal yang sama
// echo "Passing 2";
// exit();
$this->generateJadwal($sidang, $tglMulaiSidang, $waktuSidang, $tempatSidang);
}
}
}
}
// Ambil semua entri yang belum memiliki dosenPanelis1
$entriesToUpdate = SidangJadwal::whereNull('id_dosen_panelis_2')->get();
// Iterasi melalui setiap entri yang belum memiliki id_dosen_panelis_2
foreach ($entriesToUpdate as $entry) {
// Ambil id_dosen_pembimbing dari entri yang sedang diiterasi
$currentDosenId = $entry->id_dosen_pembimbing;
// Ambil dosen dengan kriteria yang sama dengan id_sidang_waktu dan id_sidang_tempat pada entri yang sedang diiterasi
$otherDosen = SidangJadwal::where('id_sidang_waktu', $entry->id_sidang_waktu)
->where('id_sidang_tempat', $entry->id_sidang_tempat)
->where('id_dosen_pembimbing', '!=', $currentDosenId) // Memastikan beda dengan dosen pada entri yang sedang diiterasi
->where('id_dosen_panelis_1', '!=', $entry->id_dosen_panelis_1)
->pluck('id_dosen_pembimbing') // Ambil hanya id_dosen_pembimbing
->toArray(); // Ubah menjadi array
// Cek apakah ditemukan dosen lain yang memenuhi kriteria
if (!empty($otherDosen)) {
// Lakukan pembaruan dengan menetapkan id_dosen_panelis_1 pada entri yang sedang diiterasi
$entry->update([
'id_dosen_panelis_2' => $otherDosen[0] // Ambil dosen pertama yang memenuhi kriteria
]);
}
}
// echo "Finish";
// exit;
return redirect('sidang')->with('toast_success', 'Generate Jadwal Sidang Berhasil.');
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
// Validasi data yang diterima dari request
$request->validate([
'id_sidang_tempat' => 'required',
'id_sidang_waktu' => 'required',
'tanggal_sidang' => 'required|date',
'id_dosen_panelis_2' => 'required',
]);
// Cari data SidangJadwal berdasarkan ID
$sidangJadwal = SidangJadwal::findOrFail($id);
if($request->id_dosen_panelis_2 == $sidangJadwal->id_dosen_pembimbing)
{
return redirect()->back()->with('toast_error', 'Anggota Penguji Sama Dengan Sekretaris Pembimbing.');
} elseif($request->id_dosen_panelis_2 == $sidangJadwal->id_dosen_panelis_1)
{
return redirect()->back()->with('toast_error', 'Anggota Penguji Sama Dengan Ketua Penguji.');
} else {
// Pengecekan bentrok jadwal
$jadwalBentrok = SidangJadwal::where('tanggal_sidang', $request->tanggal_sidang)
->where('id_sidang_waktu', $request->id_sidang_waktu)
->where('id_dosen_panelis_2', $request->id_dosen_panelis_2)
->where('id', '!=', $id)
->exists();
if ($jadwalBentrok)
{
return redirect()->back()->with('toast_error', 'Anggota Penguji Sudah Memiliki Jadwal yang Sama.');
} else {
// Update data SidangJadwal dengan data baru dari request
$sidangJadwal->update([
'id_sidang_tempat' => $request->input('id_sidang_tempat'),
'id_sidang_waktu' => $request->input('id_sidang_waktu'),
'tanggal_sidang' => $request->input('tanggal_sidang'),
'id_dosen_panelis_2' => $request->input('id_dosen_panelis_2'),
]);
// Redirect ke halaman atau route yang sesuai setelah berhasil mengupdate data
return redirect()->back()->with('toast_success', 'Jadwal Sidang Berhasil Diperbarui.');
}
}
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
// Cari data SidangJadwal berdasarkan ID
$sidangJadwal = SidangJadwal::findOrFail($id);
// Hapus data SidangJadwal dari database
$sidangJadwal->delete();
// Redirect ke halaman atau route yang sesuai setelah berhasil menghapus data
return redirect()->back()->with('toast_success', 'Jadwal Sidang Berhasil Dihapus.');
}
public function reset()
{
// Menghapus semua jadwal
SidangJadwal::truncate();
return redirect()->back()->with('toast_success', 'Jadwal Sidang Berhasil Diatur Ulang.');
}
public function exportExcel()
{
return Excel::download(new SidangExport, 'sidang.xlsx');
}
public function exportPDF()
{
$sidangJadwal = SidangJadwal::with([
'pengajuan',
'mahasiswa',
'dosenPembimbing',
'dosenPanelis1',
'dosenPanelis2',
'seminarProposal',
'sidang',
'sidangWaktu',
'sidangTempat'
])->get();
$pdf = PDF::loadView('export.sidang', compact('sidangJadwal'))->setPaper('a4', 'landscape');
return $pdf->stream();
}
}

View File

@ -0,0 +1,105 @@
<?php
namespace App\Http\Controllers;
use App\Models\SidangTempat;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
class SidangTempatController extends Controller
{
/**
* Menampilkan daftar tempat seminar.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
}
/**
* Menampilkan form untuk membuat tempat seminar baru.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
}
/**
* Menyimpan tempat seminar yang baru dibuat.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$request->validate([
'kode' => 'required|unique:seminar_proposal_tempat',
'ruang' => 'required',
// 'kuota' => 'required|integer'
]);
SidangTempat::create($request->all());
return redirect('setting-sidang')->with('toast_success', 'Tempat Sidang Berhasil Ditambahkan.');
}
/**
* Menampilkan data tempat seminar tertentu.
*
* @param \App\Models\SidangTempat $tempat
* @return \Illuminate\Http\Response
*/
public function show(SidangTempat $tempat)
{
}
/**
* Menampilkan form untuk mengedit tempat seminar.
*
* @param \App\Models\SidangTempat $tempat
* @return \Illuminate\Http\Response
*/
public function edit(SidangTempat $tempat)
{
}
/**
* Mengupdate tempat seminar yang sudah ada.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
$request->validate([
'ruang' => 'required',
// 'kuota' => 'required|integer'
]);
$tempat = SidangTempat::findOrFail($id);
$tempat->update($request->all());
return redirect('setting-sidang')->with('toast_success', 'Perubahan Berhasil Disimpan.');
}
/**
* Menghapus tempat seminar.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
$tempat = SidangTempat::findOrFail($id);
$tempat->delete();
return redirect('setting-sidang')->with('toast_success', 'Tempat Sidang Berhasil Dihapus.');
}
}

View File

@ -0,0 +1,106 @@
<?php
namespace App\Http\Controllers;
use App\Models\SidangWaktu;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
class SidangWaktuController extends Controller
{
/**
* Menampilkan daftar waktu seminar.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
}
/**
* Menampilkan form untuk membuat waktu seminar baru.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
}
/**
* Menyimpan waktu seminar yang baru dibuat.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$request->validate([
'sesi' => 'required',
'waktu_mulai' => 'required|date_format:H:i',
'waktu_selesai' => 'required|date_format:H:i|after:waktu_mulai'
]);
SidangWaktu::create($request->all());
return redirect('setting-sidang')->with('toast_success', 'Waktu Sidang Berhasil Ditambahkan.');
}
/**
* Menampilkan data waktu seminar tertentu.
*
* @param \App\Models\SidangWaktu $waktu
* @return \Illuminate\Http\Response
*/
public function show(SidangWaktu $waktu)
{
}
/**
* Menampilkan form untuk mengedit waktu seminar.
*
* @param \App\Models\SidangWaktu $waktu
* @return \Illuminate\Http\Response
*/
public function edit(SidangWaktu $waktu)
{
}
/**
* Mengupdate waktu seminar yang sudah ada.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
$request->validate([
'sesi' => 'required',
'waktu_mulai' => 'required|date_format:H:i',
'waktu_selesai' => 'required|date_format:H:i|after:waktu_mulai'
]);
$waktu = SidangWaktu::findOrFail($id);
$waktu->update($request->all());
return redirect('setting-sidang')->with('toast_success', 'Perubahan Berhasil Disimpan.');
}
/**
* Menghapus waktu seminar.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
$waktu = SidangWaktu::findOrFail($id);
$waktu->delete();
return redirect('setting-sidang')->with('toast_success', 'Waktu Sidang Berhasil Dihapus.');
}
}

View File

@ -0,0 +1,81 @@
<?php
namespace App\Http\Controllers;
use App\Models\User;
use App\Models\Kriteria;
use App\Models\Subkriteria;
use Illuminate\Http\Request;
class SubkriteriaController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
$no = 1;
$subkriteria = Subkriteria::whereHas('kriteria', function($query) {
$query->where('status', 'Aktif');
})->with('kriteria')
->orderBy('id_kriteria')
->orderBy('nilai')
->get();
$kriteria = Kriteria::where('status', 'Aktif')->get();
$dosen = User::where('role', 'Dosen')->get();
return view('subkriteria', compact('no', 'subkriteria', 'kriteria', 'dosen'));
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
$request->validate([
'nama_subkriteria' => 'required',
'id_kriteria' => 'required',
'nilai' => 'required',
]);
Subkriteria::create($request->all());
return redirect('subkriteria')->with('toast_success', 'Data Sub Kriteria Berhasil Ditambahkan.');
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id)
{
$request->validate([
'nama_subkriteria' => 'required',
'id_kriteria' => 'required',
'nilai' => 'required',
]);
$subkriteria = Subkriteria::find($id);
$subkriteria->update($request->all());
return redirect('subkriteria')->with('toast_success', 'Perubahan Berhasil Disimpan.');
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
$subkriteria = Subkriteria::find($id);
$subkriteria->delete();
return redirect('subkriteria')->with('toast_success', 'Data Sub Kriteria Berhasil Dihapus.');
}
}

View File

@ -0,0 +1,53 @@
<?php
namespace App\Http\Controllers;
use App\Models\User;
use Illuminate\Http\Request;
class WelcomeController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
$admin = User::where('role', 'Admin')->count();
$dosen = User::where('role', 'Dosen')->count();
$mahasiswa = User::where('role', 'Mahasiswa')->count();
return view('welcome', compact('admin', 'dosen', 'mahasiswa'));
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
//
}
}

69
app/Http/Kernel.php Normal file
View File

@ -0,0 +1,69 @@
<?php
namespace App\Http;
use Illuminate\Foundation\Http\Kernel as HttpKernel;
class Kernel extends HttpKernel
{
/**
* The application's global HTTP middleware stack.
*
* These middleware are run during every request to your application.
*
* @var array<int, class-string|string>
*/
protected $middleware = [
// \App\Http\Middleware\TrustHosts::class,
\App\Http\Middleware\TrustProxies::class,
\Illuminate\Http\Middleware\HandleCors::class,
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class,
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
];
/**
* The application's route middleware groups.
*
* @var array<string, array<int, class-string|string>>
*/
protected $middlewareGroups = [
'web' => [
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
\RealRashid\SweetAlert\ToSweetAlert::class,
],
'api' => [
// \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
\Illuminate\Routing\Middleware\ThrottleRequests::class.':api',
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
];
/**
* The application's middleware aliases.
*
* Aliases may be used instead of class names to conveniently assign middleware to routes and groups.
*
* @var array<string, class-string|string>
*/
protected $middlewareAliases = [
'auth' => \App\Http\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class,
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
'precognitive' => \Illuminate\Foundation\Http\Middleware\HandlePrecognitiveRequests::class,
'signed' => \App\Http\Middleware\ValidateSignature::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
];
}

View File

@ -0,0 +1,17 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Auth\Middleware\Authenticate as Middleware;
use Illuminate\Http\Request;
class Authenticate extends Middleware
{
/**
* Get the path the user should be redirected to when they are not authenticated.
*/
protected function redirectTo(Request $request): ?string
{
return $request->expectsJson() ? null : route('login');
}
}

View File

@ -0,0 +1,17 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
class EncryptCookies extends Middleware
{
/**
* The names of the cookies that should not be encrypted.
*
* @var array<int, string>
*/
protected $except = [
//
];
}

View File

@ -0,0 +1,17 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance as Middleware;
class PreventRequestsDuringMaintenance extends Middleware
{
/**
* The URIs that should be reachable while maintenance mode is enabled.
*
* @var array<int, string>
*/
protected $except = [
//
];
}

View File

@ -0,0 +1,30 @@
<?php
namespace App\Http\Middleware;
use App\Providers\RouteServiceProvider;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Symfony\Component\HttpFoundation\Response;
class RedirectIfAuthenticated
{
/**
* Handle an incoming request.
*
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
*/
public function handle(Request $request, Closure $next, string ...$guards): Response
{
$guards = empty($guards) ? [null] : $guards;
foreach ($guards as $guard) {
if (Auth::guard($guard)->check()) {
return redirect(RouteServiceProvider::HOME);
}
}
return $next($request);
}
}

View File

@ -0,0 +1,19 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware;
class TrimStrings extends Middleware
{
/**
* The names of the attributes that should not be trimmed.
*
* @var array<int, string>
*/
protected $except = [
'current_password',
'password',
'password_confirmation',
];
}

View File

@ -0,0 +1,20 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Http\Middleware\TrustHosts as Middleware;
class TrustHosts extends Middleware
{
/**
* Get the host patterns that should be trusted.
*
* @return array<int, string|null>
*/
public function hosts(): array
{
return [
$this->allSubdomainsOfApplicationUrl(),
];
}
}

View File

@ -0,0 +1,28 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Http\Middleware\TrustProxies as Middleware;
use Illuminate\Http\Request;
class TrustProxies extends Middleware
{
/**
* The trusted proxies for this application.
*
* @var array<int, string>|string|null
*/
protected $proxies;
/**
* The headers that should be used to detect proxies.
*
* @var int
*/
protected $headers =
Request::HEADER_X_FORWARDED_FOR |
Request::HEADER_X_FORWARDED_HOST |
Request::HEADER_X_FORWARDED_PORT |
Request::HEADER_X_FORWARDED_PROTO |
Request::HEADER_X_FORWARDED_AWS_ELB;
}

View File

@ -0,0 +1,22 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Routing\Middleware\ValidateSignature as Middleware;
class ValidateSignature extends Middleware
{
/**
* The names of the query string parameters that should be ignored.
*
* @var array<int, string>
*/
protected $except = [
// 'fbclid',
// 'utm_campaign',
// 'utm_content',
// 'utm_medium',
// 'utm_source',
// 'utm_term',
];
}

View File

@ -0,0 +1,17 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
class VerifyCsrfToken extends Middleware
{
/**
* The URIs that should be excluded from CSRF verification.
*
* @var array<int, string>
*/
protected $except = [
//
];
}

19
app/Models/Alternatif.php Normal file
View File

@ -0,0 +1,19 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Alternatif extends Model
{
use HasFactory;
public $table = "alternatif";
protected $fillable = [
'id',
'nama',
'id_mahasiswa',
];
}

32
app/Models/Kriteria.php Normal file
View File

@ -0,0 +1,32 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Factories\HasFactory;
class Kriteria extends Model
{
use HasFactory;
public $table = "kriteria";
protected $fillable = [
'id',
'nama_kriteria',
'jenis',
'status',
'nilai'
];
public function Subkriteria(): HasMany
{
return $this->hasMany(Subkriteria::class, 'id_kriteria', 'id');
}
public function Perbandingan(): HasMany
{
return $this->hasMany(Perbandingan::class,'id_kriteria_1','id');
}
}

23
app/Models/Nilai.php Normal file
View File

@ -0,0 +1,23 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Nilai extends Model
{
use HasFactory;
public $table = "nilai";
protected $fillable = [
'id',
'id_kriteria',
'nilai',
];
function Kriteria(){
return $this->belongsTo(Kriteria::class,'id_kriteria','id');
}
}

44
app/Models/Pengajuan.php Normal file
View File

@ -0,0 +1,44 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Pengajuan extends Model
{
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'pengajuan';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'id_mahasiswa',
'id_dosen_pembimbing',
'judul',
'jumlah_bimbingan',
'status',
];
/**
* Get the mahasiswa for the pengajuan.
*/
public function mahasiswa()
{
return $this->belongsTo(User::class, 'id_mahasiswa');
}
/**
* Get the dosen pembimbing for the pengajuan.
*/
public function dosenPembimbing()
{
return $this->belongsTo(User::class, 'id_dosen_pembimbing');
}
}

20
app/Models/Penilaian.php Normal file
View File

@ -0,0 +1,20 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Penilaian extends Model
{
use HasFactory;
public $table = "penilaian";
protected $fillable = [
'id',
'id_alternatif',
'id_kriteria',
'nilai'
];
}

View File

@ -0,0 +1,20 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Perbandingan extends Model
{
use HasFactory;
public $table = "perbandingan";
protected $fillable = [
'id',
'id_kriteria_1',
'id_kriteria_2',
'nilai'
];
}

View File

@ -0,0 +1,66 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class SeminarJadwal extends Model
{
use HasFactory;
protected $table = 'seminar_jadwal';
protected $fillable = [
'id_pengajuan',
'id_mahasiswa',
'id_dosen_pembimbing',
'id_dosen_panelis_1',
'id_seminar_proposal',
'id_seminar_proposal_waktu',
'id_seminar_proposal_tempat',
'tanggal_seminar',
];
// Relasi ke tabel Pengajuan
public function pengajuan()
{
return $this->belongsTo(Pengajuan::class, 'id_pengajuan');
}
// Relasi ke tabel User (Mahasiswa)
public function mahasiswa()
{
return $this->belongsTo(User::class, 'id_mahasiswa');
}
// Relasi ke tabel User (Dosen Pembimbing)
public function dosenPembimbing()
{
return $this->belongsTo(User::class, 'id_dosen_pembimbing');
}
// Relasi ke tabel User (Dosen Panelis)
public function dosenPanelis1()
{
return $this->belongsTo(User::class, 'id_dosen_panelis_1');
}
// Relasi ke tabel SeminarProposal
public function seminarProposal()
{
return $this->belongsTo(SeminarProposal::class, 'id_seminar_proposal');
}
// Relasi ke tabel SeminarProposalWaktu
public function seminarProposalWaktu()
{
return $this->belongsTo(SeminarProposalWaktu::class, 'id_seminar_proposal_waktu');
}
// Relasi ke tabel SeminarProposalTempat
public function seminarProposalTempat()
{
return $this->belongsTo(SeminarProposalTempat::class, 'id_seminar_proposal_tempat');
}
}

View File

@ -0,0 +1,34 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class SeminarProposal extends Model
{
use HasFactory;
protected $table = 'seminar_proposal';
protected $fillable = [
'id_mahasiswa',
'id_pengajuan',
'berkas',
];
public function mahasiswa()
{
return $this->belongsTo(User::class, 'id_mahasiswa');
}
public function pengajuan()
{
return $this->belongsTo(Pengajuan::class, 'id_pengajuan');
}
public function seminarJadwal()
{
return $this->hasMany(SeminarJadwal::class, 'id_seminar_proposal');
}
}

View File

@ -0,0 +1,19 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class SeminarProposalTempat extends Model
{
use HasFactory;
protected $table = 'seminar_proposal_tempat';
protected $fillable = [
'kode',
'ruang',
// 'kuota'
];
}

View File

@ -0,0 +1,19 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class SeminarProposalWaktu extends Model
{
use HasFactory;
protected $table = 'seminar_proposal_waktu';
protected $fillable = [
'sesi',
'waktu_mulai',
'waktu_selesai'
];
}

View File

@ -0,0 +1,21 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class SettingPengajuan extends Model
{
use HasFactory;
public $table = "setting-pengajuan";
protected $fillable = [
'id',
'tglMulai',
'tglSelesai',
'maxPembimbing',
'maxMahasiswa',
];
}

View File

@ -0,0 +1,21 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class SettingSempro extends Model
{
use HasFactory;
public $table = "setting_sempro";
protected $fillable = [
'id',
'tgl_mulai_pendaftaran',
'tgl_selesai_pendaftaran',
'tgl_mulai_sidang',
'tgl_akhir_sidang',
];
}

View File

@ -0,0 +1,21 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class SettingSidang extends Model
{
use HasFactory;
public $table = "setting_sidang";
protected $fillable = [
'id',
'tgl_mulai_pendaftaran',
'tgl_selesai_pendaftaran',
'tgl_mulai_sidang',
'tgl_akhir_sidang',
];
}

43
app/Models/Sidang.php Normal file
View File

@ -0,0 +1,43 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Sidang extends Model
{
use HasFactory;
protected $table = 'sidang';
protected $fillable = [
'id_mahasiswa',
'id_pengajuan',
'id_seminar_proposal',
'berkas',
];
// Relationship dengan model User (Mahasiswa)
public function mahasiswa()
{
return $this->belongsTo(User::class, 'id_mahasiswa');
}
// Relationship dengan model Pengajuan
public function pengajuan()
{
return $this->belongsTo(Pengajuan::class, 'id_pengajuan');
}
// Relationship dengan model SeminarProposal
public function seminarProposal()
{
return $this->belongsTo(SeminarProposal::class, 'id_seminar_proposal');
}
public function sidangJadwal()
{
return $this->hasMany(SidangJadwal::class, 'id_sidang');
}
}

View File

@ -0,0 +1,71 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class SidangJadwal extends Model
{
use HasFactory;
protected $table = 'sidang_jadwal';
protected $fillable = [
'id_pengajuan',
'id_mahasiswa',
'id_dosen_pembimbing',
'id_dosen_panelis_1',
'id_dosen_panelis_2',
'id_seminar_proposal',
'id_sidang',
'id_sidang_waktu',
'id_sidang_tempat',
'tanggal_sidang',
];
public function pengajuan()
{
return $this->belongsTo(Pengajuan::class, 'id_pengajuan');
}
public function mahasiswa()
{
return $this->belongsTo(User::class, 'id_mahasiswa');
}
public function dosenPembimbing()
{
return $this->belongsTo(User::class, 'id_dosen_pembimbing');
}
public function dosenPanelis1()
{
return $this->belongsTo(User::class, 'id_dosen_panelis_1');
}
public function dosenPanelis2()
{
return $this->belongsTo(User::class, 'id_dosen_panelis_2');
}
public function seminarProposal()
{
return $this->belongsTo(SeminarProposal::class, 'id_seminar_proposal');
}
public function sidang()
{
return $this->belongsTo(Sidang::class, 'id_sidang');
}
public function sidangWaktu()
{
return $this->belongsTo(SidangWaktu::class, 'id_sidang_waktu');
}
public function sidangTempat()
{
return $this->belongsTo(SidangTempat::class, 'id_sidang_tempat');
}
}

View File

@ -0,0 +1,19 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class SidangTempat extends Model
{
use HasFactory;
protected $table = 'sidang_tempat';
protected $fillable = [
'kode',
'ruang',
// 'kuota'
];
}

View File

@ -0,0 +1,19 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class SidangWaktu extends Model
{
use HasFactory;
protected $table = 'sidang_waktu';
protected $fillable = [
'sesi',
'waktu_mulai',
'waktu_selesai'
];
}

View File

@ -0,0 +1,26 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class Subkriteria extends Model
{
use HasFactory;
public $table = "subkriteria";
protected $fillable = [
'id',
'nama_subkriteria',
'id_kriteria',
'nilai'
];
public function Kriteria(): BelongsTo
{
return $this->belongsTo(Kriteria::class, 'id_kriteria', 'id');
}
}

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

@ -0,0 +1,72 @@
<?php
namespace App\Models;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Fortify\TwoFactorAuthenticatable;
use Laravel\Jetstream\HasProfilePhoto;
use Laravel\Sanctum\HasApiTokens;
class User extends Authenticatable implements MustVerifyEmail
{
use HasApiTokens;
use HasFactory;
use HasProfilePhoto;
use Notifiable;
use TwoFactorAuthenticatable;
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'name',
'nomor',
'golongan',
'angkatan',
'judul',
'ipk',
'pembimbing',
'prodi',
'jabatan',
'keahlian',
'minat',
'email',
'password',
];
/**
* The attributes that should be hidden for serialization.
*
* @var array<int, string>
*/
protected $hidden = [
'password',
'remember_token',
'two_factor_recovery_codes',
'two_factor_secret',
];
/**
* The attributes that should be cast.
*
* @var array<string, string>
*/
protected $casts = [
'email_verified_at' => 'datetime',
];
/**
* The accessors to append to the model's array form.
*
* @var array<int, string>
*/
protected $appends = [
'profile_photo_url',
];
}

View File

@ -0,0 +1,24 @@
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*/
public function register(): void
{
//
}
/**
* Bootstrap any application services.
*/
public function boot(): void
{
//
}
}

View File

@ -0,0 +1,26 @@
<?php
namespace App\Providers;
// use Illuminate\Support\Facades\Gate;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
class AuthServiceProvider extends ServiceProvider
{
/**
* The model to policy mappings for the application.
*
* @var array<class-string, class-string>
*/
protected $policies = [
//
];
/**
* Register any authentication / authorization services.
*/
public function boot(): void
{
//
}
}

View File

@ -0,0 +1,19 @@
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Broadcast;
use Illuminate\Support\ServiceProvider;
class BroadcastServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*/
public function boot(): void
{
Broadcast::routes();
require base_path('routes/channels.php');
}
}

View File

@ -0,0 +1,38 @@
<?php
namespace App\Providers;
use Illuminate\Auth\Events\Registered;
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Event;
class EventServiceProvider extends ServiceProvider
{
/**
* The event to listener mappings for the application.
*
* @var array<class-string, array<int, class-string>>
*/
protected $listen = [
Registered::class => [
SendEmailVerificationNotification::class,
],
];
/**
* Register any events for your application.
*/
public function boot(): void
{
//
}
/**
* Determine if events and listeners should be automatically discovered.
*/
public function shouldDiscoverEvents(): bool
{
return false;
}
}

View File

@ -0,0 +1,46 @@
<?php
namespace App\Providers;
use App\Actions\Fortify\CreateNewUser;
use App\Actions\Fortify\ResetUserPassword;
use App\Actions\Fortify\UpdateUserPassword;
use App\Actions\Fortify\UpdateUserProfileInformation;
use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\RateLimiter;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Str;
use Laravel\Fortify\Fortify;
class FortifyServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*/
public function register(): void
{
//
}
/**
* Bootstrap any application services.
*/
public function boot(): void
{
Fortify::createUsersUsing(CreateNewUser::class);
Fortify::updateUserProfileInformationUsing(UpdateUserProfileInformation::class);
Fortify::updateUserPasswordsUsing(UpdateUserPassword::class);
Fortify::resetUserPasswordsUsing(ResetUserPassword::class);
RateLimiter::for('login', function (Request $request) {
$throttleKey = Str::transliterate(Str::lower($request->input(Fortify::username())).'|'.$request->ip());
return Limit::perMinute(5)->by($throttleKey);
});
RateLimiter::for('two-factor', function (Request $request) {
return Limit::perMinute(5)->by($request->session()->get('login.id'));
});
}
}

View File

@ -0,0 +1,43 @@
<?php
namespace App\Providers;
use App\Actions\Jetstream\DeleteUser;
use Illuminate\Support\ServiceProvider;
use Laravel\Jetstream\Jetstream;
class JetstreamServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*/
public function register(): void
{
//
}
/**
* Bootstrap any application services.
*/
public function boot(): void
{
$this->configurePermissions();
Jetstream::deleteUsersUsing(DeleteUser::class);
}
/**
* Configure the permissions that are available within the application.
*/
protected function configurePermissions(): void
{
Jetstream::defaultApiTokenPermissions(['read']);
Jetstream::permissions([
'create',
'read',
'update',
'delete',
]);
}
}

View File

@ -0,0 +1,40 @@
<?php
namespace App\Providers;
use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\RateLimiter;
use Illuminate\Support\Facades\Route;
class RouteServiceProvider extends ServiceProvider
{
/**
* The path to your application's "home" route.
*
* Typically, users are redirected here after authentication.
*
* @var string
*/
public const HOME = 'dashboard';
/**
* Define your route model bindings, pattern filters, and other route configuration.
*/
public function boot(): void
{
RateLimiter::for('api', function (Request $request) {
return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip());
});
$this->routes(function () {
Route::middleware('api')
->prefix('api')
->group(base_path('routes/api.php'));
Route::middleware('web')
->group(base_path('routes/web.php'));
});
}
}

View File

@ -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');
}
}

View File

@ -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');
}
}

53
artisan Normal file
View File

@ -0,0 +1,53 @@
#!/usr/bin/env php
<?php
define('LARAVEL_START', microtime(true));
/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader
| for our application. We just need to utilize it! We'll require it
| into the script here so that we do not have to worry about the
| loading of any of our classes manually. It's great to relax.
|
*/
require __DIR__.'/vendor/autoload.php';
$app = require_once __DIR__.'/bootstrap/app.php';
/*
|--------------------------------------------------------------------------
| Run The Artisan Application
|--------------------------------------------------------------------------
|
| When we run the console application, the current CLI command will be
| executed in this console and the response sent back to a terminal
| or another output device for the developers. Here goes nothing!
|
*/
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
$status = $kernel->handle(
$input = new Symfony\Component\Console\Input\ArgvInput,
new Symfony\Component\Console\Output\ConsoleOutput
);
/*
|--------------------------------------------------------------------------
| Shutdown The Application
|--------------------------------------------------------------------------
|
| Once Artisan has finished running, we will fire off the shutdown events
| so that any final work may be done by the application before we shut
| down the process. This is the last thing to happen to the request.
|
*/
$kernel->terminate($input, $status);
exit($status);

55
bootstrap/app.php Normal file
View File

@ -0,0 +1,55 @@
<?php
/*
|--------------------------------------------------------------------------
| Create The Application
|--------------------------------------------------------------------------
|
| The first thing we will do is create a new Laravel application instance
| which serves as the "glue" for all the components of Laravel, and is
| the IoC container for the system binding all of the various parts.
|
*/
$app = new Illuminate\Foundation\Application(
$_ENV['APP_BASE_PATH'] ?? dirname(__DIR__)
);
/*
|--------------------------------------------------------------------------
| Bind Important Interfaces
|--------------------------------------------------------------------------
|
| Next, we need to bind some important interfaces into the container so
| we will be able to resolve them when needed. The kernels serve the
| incoming requests to this application from both the web and CLI.
|
*/
$app->singleton(
Illuminate\Contracts\Http\Kernel::class,
App\Http\Kernel::class
);
$app->singleton(
Illuminate\Contracts\Console\Kernel::class,
App\Console\Kernel::class
);
$app->singleton(
Illuminate\Contracts\Debug\ExceptionHandler::class,
App\Exceptions\Handler::class
);
/*
|--------------------------------------------------------------------------
| Return The Application
|--------------------------------------------------------------------------
|
| This script returns the application instance. The instance is given to
| the calling script so we can separate the building of the instances
| from the actual running of the application and sending responses.
|
*/
return $app;

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

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

71
composer.json Normal file
View File

@ -0,0 +1,71 @@
{
"name": "laravel/laravel",
"type": "project",
"description": "The skeleton application for the Laravel framework.",
"keywords": ["laravel", "framework"],
"license": "MIT",
"require": {
"php": "^8.1",
"barryvdh/laravel-dompdf": "*",
"guzzlehttp/guzzle": "^7.2",
"laravel/framework": "^10.10",
"laravel/jetstream": "^4.0",
"laravel/sanctum": "^3.2",
"laravel/tinker": "^2.8",
"livewire/livewire": "^3.0",
"maatwebsite/excel": "~2.1.0",
"realrashid/sweet-alert": "^7.1"
},
"require-dev": {
"fakerphp/faker": "^1.9.1",
"laravel/pint": "^1.0",
"laravel/sail": "^1.18",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^7.0",
"phpunit/phpunit": "^10.1",
"spatie/laravel-ignition": "^2.0"
},
"autoload": {
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-update-cmd": [
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi"
]
},
"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
}

9667
composer.lock generated Normal file

File diff suppressed because it is too large Load Diff

196
config/app.php Normal file
View File

@ -0,0 +1,196 @@
<?php
use Illuminate\Support\Facades\Facade;
use Illuminate\Support\ServiceProvider;
return [
/*
|--------------------------------------------------------------------------
| Application Name
|--------------------------------------------------------------------------
|
| This value is the name of your application. This value is used when the
| framework needs to place the application's name in a notification or
| any other location as required by the application or its packages.
|
*/
'name' => env('APP_NAME', 'SIMANTA'),
/*
|--------------------------------------------------------------------------
| 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
| your application so that it is used when running Artisan tasks.
|
*/
'url' => env('APP_URL', 'http://localhost'),
'asset_url' => env('ASSET_URL'),
/*
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
|
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. We have gone
| ahead and set this to a sensible default for you out of the box.
|
*/
'timezone' => 'UTC',
/*
|--------------------------------------------------------------------------
| Application Locale Configuration
|--------------------------------------------------------------------------
|
| The application locale determines the default locale that will be used
| by the translation service provider. You are free to set this value
| to any of the locales which will be supported by the application.
|
*/
'locale' => 'en',
/*
|--------------------------------------------------------------------------
| Application Fallback Locale
|--------------------------------------------------------------------------
|
| The fallback locale determines the locale to use when the current one
| is not available. You may change the value to correspond to any of
| the language folders that are provided through your application.
|
*/
'fallback_locale' => 'en',
/*
|--------------------------------------------------------------------------
| Faker Locale
|--------------------------------------------------------------------------
|
| This locale will be used by the Faker PHP library when generating fake
| data for your database seeds. For example, this will be used to get
| localized telephone numbers, street address information and more.
|
*/
'faker_locale' => 'en_US',
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| This key is used by the Illuminate encrypter service and should be set
| to a random, 32 character string, otherwise these encrypted strings
| will not be safe. Please do this before deploying an application!
|
*/
'key' => env('APP_KEY'),
'cipher' => 'AES-256-CBC',
/*
|--------------------------------------------------------------------------
| 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' => 'file',
// 'store' => 'redis',
],
/*
|--------------------------------------------------------------------------
| Autoloaded Service Providers
|--------------------------------------------------------------------------
|
| The service providers listed here will be automatically loaded on the
| request to your application. Feel free to add your own services to
| this array to grant expanded functionality to your applications.
|
*/
'providers' => ServiceProvider::defaultProviders()->merge([
/*
* Package Service Providers...
*/
/*
* Application Service Providers...
*/
App\Providers\AppServiceProvider::class,
App\Providers\AuthServiceProvider::class,
// App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,
App\Providers\FortifyServiceProvider::class,
App\Providers\JetstreamServiceProvider::class,
RealRashid\SweetAlert\SweetAlertServiceProvider::class,
Maatwebsite\Excel\ExcelServiceProvider::class,
Barryvdh\DomPDF\ServiceProvider::class,
])->toArray(),
/*
|--------------------------------------------------------------------------
| Class Aliases
|--------------------------------------------------------------------------
|
| This array of class aliases will be registered when this application
| is started. However, feel free to register as many as you wish as
| the aliases are "lazy" loaded so they don't hinder performance.
|
*/
'aliases' => Facade::defaultAliases()->merge([
// 'Example' => App\Facades\Example::class,
'Alert' => RealRashid\SweetAlert\Facades\Alert::class,
'Excel' => Maatwebsite\Excel\Facades\Excel::class,
'PDF' => Barryvdh\DomPDF\Facade\Pdf::class,
])->toArray(),
];

115
config/auth.php Normal file
View File

@ -0,0 +1,115 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Authentication Defaults
|--------------------------------------------------------------------------
|
| This option controls the default authentication "guard" and password
| reset options for your application. You may change these defaults
| as required, but they're a perfect start for most applications.
|
*/
'defaults' => [
'guard' => 'web',
'passwords' => 'users',
],
/*
|--------------------------------------------------------------------------
| Authentication Guards
|--------------------------------------------------------------------------
|
| Next, you may define every authentication guard for your application.
| Of course, a great default configuration has been defined for you
| here which uses session storage and the Eloquent user provider.
|
| All authentication drivers have a user provider. This defines how the
| users are actually retrieved out of your database or other storage
| mechanisms used by this application to persist your user's data.
|
| Supported: "session"
|
*/
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
],
/*
|--------------------------------------------------------------------------
| User Providers
|--------------------------------------------------------------------------
|
| All authentication drivers have a user provider. This defines how the
| users are actually retrieved out of your database or other storage
| mechanisms used by this application to persist your user's data.
|
| If you have multiple user tables or models you may configure multiple
| sources which represent each model / table. These sources may then
| be assigned to any extra authentication guards you have defined.
|
| Supported: "database", "eloquent"
|
*/
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => App\Models\User::class,
],
// 'users' => [
// 'driver' => 'database',
// 'table' => 'users',
// ],
],
/*
|--------------------------------------------------------------------------
| Resetting Passwords
|--------------------------------------------------------------------------
|
| You may specify multiple password reset configurations if you have more
| than one user table or model in the application and you want to have
| separate password reset settings based on the specific user types.
|
| The expiry time is the number of minutes that each reset token will be
| considered valid. This security feature keeps tokens short-lived so
| they have less time to be guessed. You may change this as needed.
|
| The throttle setting is the number of seconds a user must wait before
| generating more password reset tokens. This prevents the user from
| quickly generating a very large amount of password reset tokens.
|
*/
'passwords' => [
'users' => [
'provider' => 'users',
'table' => 'password_reset_tokens',
'expire' => 60,
'throttle' => 60,
],
],
/*
|--------------------------------------------------------------------------
| Password Confirmation Timeout
|--------------------------------------------------------------------------
|
| Here you may define the amount of seconds before a password confirmation
| times out and the user is prompted to re-enter their password via the
| confirmation screen. By default, the timeout lasts for three hours.
|
*/
'password_timeout' => 10800,
];

71
config/broadcasting.php Normal file
View File

@ -0,0 +1,71 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Broadcaster
|--------------------------------------------------------------------------
|
| This option controls the default broadcaster that will be used by the
| framework when an event needs to be broadcast. You may set this to
| any of the connections defined in the "connections" array below.
|
| Supported: "pusher", "ably", "redis", "log", "null"
|
*/
'default' => env('BROADCAST_DRIVER', 'null'),
/*
|--------------------------------------------------------------------------
| Broadcast Connections
|--------------------------------------------------------------------------
|
| Here you may define all of the broadcast connections that will be used
| to broadcast events to other systems or over websockets. Samples of
| each available type of connection are provided inside this array.
|
*/
'connections' => [
'pusher' => [
'driver' => 'pusher',
'key' => env('PUSHER_APP_KEY'),
'secret' => env('PUSHER_APP_SECRET'),
'app_id' => env('PUSHER_APP_ID'),
'options' => [
'cluster' => env('PUSHER_APP_CLUSTER'),
'host' => env('PUSHER_HOST') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com',
'port' => env('PUSHER_PORT', 443),
'scheme' => env('PUSHER_SCHEME', 'https'),
'encrypted' => true,
'useTLS' => env('PUSHER_SCHEME', 'https') === 'https',
],
'client_options' => [
// Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html
],
],
'ably' => [
'driver' => 'ably',
'key' => env('ABLY_KEY'),
],
'redis' => [
'driver' => 'redis',
'connection' => 'default',
],
'log' => [
'driver' => 'log',
],
'null' => [
'driver' => 'null',
],
],
];

111
config/cache.php Normal file
View File

@ -0,0 +1,111 @@
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Cache Store
|--------------------------------------------------------------------------
|
| This option controls the default cache connection that gets used while
| using this caching library. This connection is used when another is
| not explicitly specified when executing a given caching function.
|
*/
'default' => env('CACHE_DRIVER', 'file'),
/*
|--------------------------------------------------------------------------
| 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: "apc", "array", "database", "file",
| "memcached", "redis", "dynamodb", "octane", "null"
|
*/
'stores' => [
'apc' => [
'driver' => 'apc',
],
'array' => [
'driver' => 'array',
'serialize' => false,
],
'database' => [
'driver' => 'database',
'table' => 'cache',
'connection' => null,
'lock_connection' => null,
],
'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' => 'cache',
'lock_connection' => 'default',
],
'dynamodb' => [
'driver' => 'dynamodb',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
'table' => env('DYNAMODB_CACHE_TABLE', 'cache'),
'endpoint' => env('DYNAMODB_ENDPOINT'),
],
'octane' => [
'driver' => 'octane',
],
],
/*
|--------------------------------------------------------------------------
| Cache Key Prefix
|--------------------------------------------------------------------------
|
| When utilizing the APC, database, memcached, Redis, or DynamoDB cache
| stores there might be other applications using the same cache. For
| that reason, you may prefix every cache key to avoid collisions.
|
*/
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache_'),
];

34
config/cors.php Normal file
View File

@ -0,0 +1,34 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Cross-Origin Resource Sharing (CORS) Configuration
|--------------------------------------------------------------------------
|
| Here you may configure your settings for cross-origin resource sharing
| or "CORS". This determines what cross-origin operations may execute
| in web browsers. You are free to adjust these settings as needed.
|
| To learn more: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
|
*/
'paths' => ['api/*', 'sanctum/csrf-cookie'],
'allowed_methods' => ['*'],
'allowed_origins' => ['*'],
'allowed_origins_patterns' => [],
'allowed_headers' => ['*'],
'exposed_headers' => [],
'max_age' => 0,
'supports_credentials' => false,
];

151
config/database.php Normal file
View File

@ -0,0 +1,151 @@
<?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 all database work. Of course
| you may use many connections at once using the Database library.
|
*/
'default' => env('DB_CONNECTION', 'mysql'),
/*
|--------------------------------------------------------------------------
| Database Connections
|--------------------------------------------------------------------------
|
| Here are each of the database connections setup for your application.
| Of course, examples of configuring each database platform that is
| supported by Laravel is shown below to make development simple.
|
|
| All database work in Laravel is done through the PHP PDO facilities
| so make sure you have the driver for your particular database of
| choice installed on your machine before you begin development.
|
*/
'connections' => [
'sqlite' => [
'driver' => 'sqlite',
'url' => env('DATABASE_URL'),
'database' => env('DB_DATABASE', database_path('database.sqlite')),
'prefix' => '',
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
],
'mysql' => [
'driver' => 'mysql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
'pgsql' => [
'driver' => 'pgsql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'prefix_indexes' => true,
'search_path' => 'public',
'sslmode' => 'prefer',
],
'sqlsrv' => [
'driver' => 'sqlsrv',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '1433'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'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 in the database.
|
*/
'migrations' => 'migrations',
/*
|--------------------------------------------------------------------------
| 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 APC or Memcached. Laravel makes it easy to dig right in.
|
*/
'redis' => [
'client' => env('REDIS_CLIENT', 'phpredis'),
'options' => [
'cluster' => env('REDIS_CLUSTER', 'redis'),
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
],
'default' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'username' => env('REDIS_USERNAME'),
'password' => env('REDIS_PASSWORD'),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_DB', '0'),
],
'cache' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'username' => env('REDIS_USERNAME'),
'password' => env('REDIS_PASSWORD'),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_CACHE_DB', '1'),
],
],
];

284
config/dompdf.php Normal file
View File

@ -0,0 +1,284 @@
<?php
return array(
/*
|--------------------------------------------------------------------------
| Settings
|--------------------------------------------------------------------------
|
| Set some default values. It is possible to add all defines that can be set
| in dompdf_config.inc.php. You can also override the entire config file.
|
*/
'show_warnings' => false, // Throw an Exception on warnings from dompdf
'public_path' => null, // Override the public path if needed
/*
* Dejavu Sans font is missing glyphs for converted entities, turn it off if you need to show and £.
*/
'convert_entities' => true,
'options' => array(
/**
* The location of the DOMPDF font directory
*
* The location of the directory where DOMPDF will store fonts and font metrics
* Note: This directory must exist and be writable by the webserver process.
* *Please note the trailing slash.*
*
* Notes regarding fonts:
* Additional .afm font metrics can be added by executing load_font.php from command line.
*
* Only the original "Base 14 fonts" are present on all pdf viewers. Additional fonts must
* be embedded in the pdf file or the PDF may not display correctly. This can significantly
* increase file size unless font subsetting is enabled. Before embedding a font please
* review your rights under the font license.
*
* Any font specification in the source HTML is translated to the closest font available
* in the font directory.
*
* The pdf standard "Base 14 fonts" are:
* Courier, Courier-Bold, Courier-BoldOblique, Courier-Oblique,
* Helvetica, Helvetica-Bold, Helvetica-BoldOblique, Helvetica-Oblique,
* Times-Roman, Times-Bold, Times-BoldItalic, Times-Italic,
* Symbol, ZapfDingbats.
*/
"font_dir" => storage_path('fonts'), // advised by dompdf (https://github.com/dompdf/dompdf/pull/782)
/**
* The location of the DOMPDF font cache directory
*
* This directory contains the cached font metrics for the fonts used by DOMPDF.
* This directory can be the same as DOMPDF_FONT_DIR
*
* Note: This directory must exist and be writable by the webserver process.
*/
"font_cache" => storage_path('fonts'),
/**
* The location of a temporary directory.
*
* The directory specified must be writeable by the webserver process.
* The temporary directory is required to download remote images and when
* using the PDFLib back end.
*/
"temp_dir" => sys_get_temp_dir(),
/**
* ==== IMPORTANT ====
*
* dompdf's "chroot": Prevents dompdf from accessing system files or other
* files on the webserver. All local files opened by dompdf must be in a
* subdirectory of this directory. DO NOT set it to '/' since this could
* allow an attacker to use dompdf to read any files on the server. This
* should be an absolute path.
* This is only checked on command line call by dompdf.php, but not by
* direct class use like:
* $dompdf = new DOMPDF(); $dompdf->load_html($htmldata); $dompdf->render(); $pdfdata = $dompdf->output();
*/
"chroot" => realpath(base_path()),
/**
* Protocol whitelist
*
* Protocols and PHP wrappers allowed in URIs, and the validation rules
* that determine if a resouce may be loaded. Full support is not guaranteed
* for the protocols/wrappers specified
* by this array.
*
* @var array
*/
'allowed_protocols' => [
"file://" => ["rules" => []],
"http://" => ["rules" => []],
"https://" => ["rules" => []]
],
/**
* @var string
*/
'log_output_file' => null,
/**
* Whether to enable font subsetting or not.
*/
"enable_font_subsetting" => false,
/**
* The PDF rendering backend to use
*
* Valid settings are 'PDFLib', 'CPDF' (the bundled R&OS PDF class), 'GD' and
* 'auto'. 'auto' will look for PDFLib and use it if found, or if not it will
* fall back on CPDF. 'GD' renders PDFs to graphic files. {@link
* Canvas_Factory} ultimately determines which rendering class to instantiate
* based on this setting.
*
* Both PDFLib & CPDF rendering backends provide sufficient rendering
* capabilities for dompdf, however additional features (e.g. object,
* image and font support, etc.) differ between backends. Please see
* {@link PDFLib_Adapter} for more information on the PDFLib backend
* and {@link CPDF_Adapter} and lib/class.pdf.php for more information
* on CPDF. Also see the documentation for each backend at the links
* below.
*
* The GD rendering backend is a little different than PDFLib and
* CPDF. Several features of CPDF and PDFLib are not supported or do
* not make any sense when creating image files. For example,
* multiple pages are not supported, nor are PDF 'objects'. Have a
* look at {@link GD_Adapter} for more information. GD support is
* experimental, so use it at your own risk.
*
* @link http://www.pdflib.com
* @link http://www.ros.co.nz/pdf
* @link http://www.php.net/image
*/
"pdf_backend" => "CPDF",
/**
* PDFlib license key
*
* If you are using a licensed, commercial version of PDFlib, specify
* your license key here. If you are using PDFlib-Lite or are evaluating
* the commercial version of PDFlib, comment out this setting.
*
* @link http://www.pdflib.com
*
* If pdflib present in web server and auto or selected explicitely above,
* a real license code must exist!
*/
//"DOMPDF_PDFLIB_LICENSE" => "your license key here",
/**
* html target media view which should be rendered into pdf.
* List of types and parsing rules for future extensions:
* http://www.w3.org/TR/REC-html40/types.html
* screen, tty, tv, projection, handheld, print, braille, aural, all
* Note: aural is deprecated in CSS 2.1 because it is replaced by speech in CSS 3.
* Note, even though the generated pdf file is intended for print output,
* the desired content might be different (e.g. screen or projection view of html file).
* Therefore allow specification of content here.
*/
"default_media_type" => "screen",
/**
* The default paper size.
*
* North America standard is "letter"; other countries generally "a4"
*
* @see CPDF_Adapter::PAPER_SIZES for valid sizes ('letter', 'legal', 'A4', etc.)
*/
"default_paper_size" => "a4",
/**
* The default paper orientation.
*
* The orientation of the page (portrait or landscape).
*
* @var string
*/
'default_paper_orientation' => "portrait",
/**
* The default font family
*
* Used if no suitable fonts can be found. This must exist in the font folder.
* @var string
*/
"default_font" => "serif",
/**
* Image DPI setting
*
* This setting determines the default DPI setting for images and fonts. The
* DPI may be overridden for inline images by explictly setting the
* image's width & height style attributes (i.e. if the image's native
* width is 600 pixels and you specify the image's width as 72 points,
* the image will have a DPI of 600 in the rendered PDF. The DPI of
* background images can not be overridden and is controlled entirely
* via this parameter.
*
* For the purposes of DOMPDF, pixels per inch (PPI) = dots per inch (DPI).
* If a size in html is given as px (or without unit as image size),
* this tells the corresponding size in pt.
* This adjusts the relative sizes to be similar to the rendering of the
* html page in a reference browser.
*
* In pdf, always 1 pt = 1/72 inch
*
* Rendering resolution of various browsers in px per inch:
* Windows Firefox and Internet Explorer:
* SystemControl->Display properties->FontResolution: Default:96, largefonts:120, custom:?
* Linux Firefox:
* about:config *resolution: Default:96
* (xorg screen dimension in mm and Desktop font dpi settings are ignored)
*
* Take care about extra font/image zoom factor of browser.
*
* In images, <img> size in pixel attribute, img css style, are overriding
* the real image dimension in px for rendering.
*
* @var int
*/
"dpi" => 96,
/**
* Enable inline PHP
*
* If this setting is set to true then DOMPDF will automatically evaluate
* inline PHP contained within <script type="text/php"> ... </script> tags.
*
* Enabling this for documents you do not trust (e.g. arbitrary remote html
* pages) is a security risk. Set this option to false if you wish to process
* untrusted documents.
*
* @var bool
*/
"enable_php" => false,
/**
* Enable inline Javascript
*
* If this setting is set to true then DOMPDF will automatically insert
* JavaScript code contained within <script type="text/javascript"> ... </script> tags.
*
* @var bool
*/
"enable_javascript" => true,
/**
* Enable remote file access
*
* If this setting is set to true, DOMPDF will access remote sites for
* images and CSS files as required.
* This is required for part of test case www/test/image_variants.html through www/examples.php
*
* Attention!
* This can be a security risk, in particular in combination with DOMPDF_ENABLE_PHP and
* allowing remote access to dompdf.php or on allowing remote html code to be passed to
* $dompdf = new DOMPDF(, $dompdf->load_html(...,
* This allows anonymous users to download legally doubtful internet content which on
* tracing back appears to being downloaded by your server, or allows malicious php code
* in remote html pages to be executed by your server with your account privileges.
*
* @var bool
*/
"enable_remote" => true,
/**
* A ratio applied to the fonts height to be more like browsers' line height
*/
"font_height_ratio" => 1.1,
/**
* Use the HTML5 Lib parser
*
* @deprecated This feature is now always on in dompdf 2.x
* @var bool
*/
"enable_html5_parser" => true,
),
);

379
config/excel.php Normal file
View File

@ -0,0 +1,379 @@
<?php
use Maatwebsite\Excel\Excel;
return [
'exports' => [
/*
|--------------------------------------------------------------------------
| Chunk size
|--------------------------------------------------------------------------
|
| When using FromQuery, the query is automatically chunked.
| Here you can specify how big the chunk should be.
|
*/
'chunk_size' => 1000,
/*
|--------------------------------------------------------------------------
| Pre-calculate formulas during export
|--------------------------------------------------------------------------
*/
'pre_calculate_formulas' => false,
/*
|--------------------------------------------------------------------------
| Enable strict null comparison
|--------------------------------------------------------------------------
|
| When enabling strict null comparison empty cells ('') will
| be added to the sheet.
*/
'strict_null_comparison' => false,
/*
|--------------------------------------------------------------------------
| CSV Settings
|--------------------------------------------------------------------------
|
| Configure e.g. delimiter, enclosure and line ending for CSV exports.
|
*/
'csv' => [
'delimiter' => ',',
'enclosure' => '"',
'line_ending' => PHP_EOL,
'use_bom' => false,
'include_separator_line' => false,
'excel_compatibility' => false,
'output_encoding' => '',
'test_auto_detect' => true,
],
/*
|--------------------------------------------------------------------------
| Worksheet properties
|--------------------------------------------------------------------------
|
| Configure e.g. default title, creator, subject,...
|
*/
'properties' => [
'creator' => '',
'lastModifiedBy' => '',
'title' => '',
'description' => '',
'subject' => '',
'keywords' => '',
'category' => '',
'manager' => '',
'company' => '',
],
],
'imports' => [
/*
|--------------------------------------------------------------------------
| Read Only
|--------------------------------------------------------------------------
|
| When dealing with imports, you might only be interested in the
| data that the sheet exists. By default we ignore all styles,
| however if you want to do some logic based on style data
| you can enable it by setting read_only to false.
|
*/
'read_only' => true,
/*
|--------------------------------------------------------------------------
| Ignore Empty
|--------------------------------------------------------------------------
|
| When dealing with imports, you might be interested in ignoring
| rows that have null values or empty strings. By default rows
| containing empty strings or empty values are not ignored but can be
| ignored by enabling the setting ignore_empty to true.
|
*/
'ignore_empty' => false,
/*
|--------------------------------------------------------------------------
| Heading Row Formatter
|--------------------------------------------------------------------------
|
| Configure the heading row formatter.
| Available options: none|slug|custom
|
*/
'heading_row' => [
'formatter' => 'slug',
],
/*
|--------------------------------------------------------------------------
| CSV Settings
|--------------------------------------------------------------------------
|
| Configure e.g. delimiter, enclosure and line ending for CSV imports.
|
*/
'csv' => [
'delimiter' => null,
'enclosure' => '"',
'escape_character' => '\\',
'contiguous' => false,
'input_encoding' => 'UTF-8',
],
/*
|--------------------------------------------------------------------------
| Worksheet properties
|--------------------------------------------------------------------------
|
| Configure e.g. default title, creator, subject,...
|
*/
'properties' => [
'creator' => '',
'lastModifiedBy' => '',
'title' => '',
'description' => '',
'subject' => '',
'keywords' => '',
'category' => '',
'manager' => '',
'company' => '',
],
/*
|--------------------------------------------------------------------------
| Cell Middleware
|--------------------------------------------------------------------------
|
| Configure middleware that is executed on getting a cell value
|
*/
'cells' => [
'middleware' => [
//\Maatwebsite\Excel\Middleware\TrimCellValue::class,
//\Maatwebsite\Excel\Middleware\ConvertEmptyCellValuesToNull::class,
],
],
],
/*
|--------------------------------------------------------------------------
| Extension detector
|--------------------------------------------------------------------------
|
| Configure here which writer/reader type should be used when the package
| needs to guess the correct type based on the extension alone.
|
*/
'extension_detector' => [
'xlsx' => Excel::XLSX,
'xlsm' => Excel::XLSX,
'xltx' => Excel::XLSX,
'xltm' => Excel::XLSX,
'xls' => Excel::XLS,
'xlt' => Excel::XLS,
'ods' => Excel::ODS,
'ots' => Excel::ODS,
'slk' => Excel::SLK,
'xml' => Excel::XML,
'gnumeric' => Excel::GNUMERIC,
'htm' => Excel::HTML,
'html' => Excel::HTML,
'csv' => Excel::CSV,
'tsv' => Excel::TSV,
/*
|--------------------------------------------------------------------------
| PDF Extension
|--------------------------------------------------------------------------
|
| Configure here which Pdf driver should be used by default.
| Available options: Excel::MPDF | Excel::TCPDF | Excel::DOMPDF
|
*/
'pdf' => Excel::DOMPDF,
],
/*
|--------------------------------------------------------------------------
| Value Binder
|--------------------------------------------------------------------------
|
| PhpSpreadsheet offers a way to hook into the process of a value being
| written to a cell. In there some assumptions are made on how the
| value should be formatted. If you want to change those defaults,
| you can implement your own default value binder.
|
| Possible value binders:
|
| [x] Maatwebsite\Excel\DefaultValueBinder::class
| [x] PhpOffice\PhpSpreadsheet\Cell\StringValueBinder::class
| [x] PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder::class
|
*/
'value_binder' => [
'default' => Maatwebsite\Excel\DefaultValueBinder::class,
],
'cache' => [
/*
|--------------------------------------------------------------------------
| Default cell caching driver
|--------------------------------------------------------------------------
|
| By default PhpSpreadsheet keeps all cell values in memory, however when
| dealing with large files, this might result into memory issues. If you
| want to mitigate that, you can configure a cell caching driver here.
| When using the illuminate driver, it will store each value in the
| cache store. This can slow down the process, because it needs to
| store each value. You can use the "batch" store if you want to
| only persist to the store when the memory limit is reached.
|
| Drivers: memory|illuminate|batch
|
*/
'driver' => 'memory',
/*
|--------------------------------------------------------------------------
| Batch memory caching
|--------------------------------------------------------------------------
|
| When dealing with the "batch" caching driver, it will only
| persist to the store when the memory limit is reached.
| Here you can tweak the memory limit to your liking.
|
*/
'batch' => [
'memory_limit' => 60000,
],
/*
|--------------------------------------------------------------------------
| Illuminate cache
|--------------------------------------------------------------------------
|
| When using the "illuminate" caching driver, it will automatically use
| your default cache store. However if you prefer to have the cell
| cache on a separate store, you can configure the store name here.
| You can use any store defined in your cache config. When leaving
| at "null" it will use the default store.
|
*/
'illuminate' => [
'store' => null,
],
/*
|--------------------------------------------------------------------------
| Cache Time-to-live (TTL)
|--------------------------------------------------------------------------
|
| The TTL of items written to cache. If you want to keep the items cached
| indefinitely, set this to null. Otherwise, set a number of seconds,
| a \DateInterval, or a callable.
|
| Allowable types: callable|\DateInterval|int|null
|
*/
'default_ttl' => 10800,
],
/*
|--------------------------------------------------------------------------
| Transaction Handler
|--------------------------------------------------------------------------
|
| By default the import is wrapped in a transaction. This is useful
| for when an import may fail and you want to retry it. With the
| transactions, the previous import gets rolled-back.
|
| You can disable the transaction handler by setting this to null.
| Or you can choose a custom made transaction handler here.
|
| Supported handlers: null|db
|
*/
'transactions' => [
'handler' => 'db',
'db' => [
'connection' => null,
],
],
'temporary_files' => [
/*
|--------------------------------------------------------------------------
| Local Temporary Path
|--------------------------------------------------------------------------
|
| When exporting and importing files, we use a temporary file, before
| storing reading or downloading. Here you can customize that path.
| permissions is an array with the permission flags for the directory (dir)
| and the create file (file).
|
*/
'local_path' => storage_path('framework/cache/laravel-excel'),
/*
|--------------------------------------------------------------------------
| Local Temporary Path Permissions
|--------------------------------------------------------------------------
|
| Permissions is an array with the permission flags for the directory (dir)
| and the create file (file).
| If omitted the default permissions of the filesystem will be used.
|
*/
'local_permissions' => [
// 'dir' => 0755,
// 'file' => 0644,
],
/*
|--------------------------------------------------------------------------
| Remote Temporary Disk
|--------------------------------------------------------------------------
|
| When dealing with a multi server setup with queues in which you
| cannot rely on having a shared local temporary path, you might
| want to store the temporary file on a shared disk. During the
| queue executing, we'll retrieve the temporary file from that
| location instead. When left to null, it will always use
| the local path. This setting only has effect when using
| in conjunction with queued imports and exports.
|
*/
'remote_disk' => null,
'remote_prefix' => null,
/*
|--------------------------------------------------------------------------
| Force Resync
|--------------------------------------------------------------------------
|
| When dealing with a multi server setup as above, it's possible
| for the clean up that occurs after entire queue has been run to only
| cleanup the server that the last AfterImportJob runs on. The rest of the server
| would still have the local temporary file stored on it. In this case your
| local storage limits can be exceeded and future imports won't be processed.
| To mitigate this you can set this config value to be true, so that after every
| queued chunk is processed the local temporary file is deleted on the server that
| processed it.
|
*/
'force_resync_remote' => null,
],
];

76
config/filesystems.php Normal file
View File

@ -0,0 +1,76 @@
<?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. Just store away!
|
*/
'default' => env('FILESYSTEM_DISK', 'local'),
/*
|--------------------------------------------------------------------------
| Filesystem Disks
|--------------------------------------------------------------------------
|
| Here you may configure as many filesystem "disks" as you wish, and you
| may even configure multiple disks of the same driver. Defaults have
| been set up for each driver as an example of the required values.
|
| Supported Drivers: "local", "ftp", "sftp", "s3"
|
*/
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
'throw' => false,
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
'throw' => 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,
],
],
/*
|--------------------------------------------------------------------------
| 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'),
],
];

160
config/fortify.php Normal file
View File

@ -0,0 +1,160 @@
<?php
use App\Providers\RouteServiceProvider;
use Laravel\Fortify\Features;
return [
/*
|--------------------------------------------------------------------------
| Fortify Guard
|--------------------------------------------------------------------------
|
| Here you may specify which authentication guard Fortify will use while
| authenticating users. This value should correspond with one of your
| guards that is already present in your "auth" configuration file.
|
*/
'guard' => 'web',
/*
|--------------------------------------------------------------------------
| Fortify Password Broker
|--------------------------------------------------------------------------
|
| Here you may specify which password broker Fortify can use when a user
| is resetting their password. This configured value should match one
| of your password brokers setup in your "auth" configuration file.
|
*/
'passwords' => 'users',
/*
|--------------------------------------------------------------------------
| Username / Email
|--------------------------------------------------------------------------
|
| This value defines which model attribute should be considered as your
| application's "username" field. Typically, this might be the email
| address of the users but you are free to change this value here.
|
| Out of the box, Fortify expects forgot password and reset password
| requests to have a field named 'email'. If the application uses
| another name for the field you may define it below as needed.
|
*/
'username' => 'email',
'email' => 'email',
/*
|--------------------------------------------------------------------------
| Lowercase Usernames
|--------------------------------------------------------------------------
|
| This value defines whether usernames should be lowercased before saving
| them in the database, as some database system string fields are case
| sensitive. You may disable this for your application if necessary.
|
*/
'lowercase_usernames' => true,
/*
|--------------------------------------------------------------------------
| Home Path
|--------------------------------------------------------------------------
|
| Here you may configure the path where users will get redirected during
| authentication or password reset when the operations are successful
| and the user is authenticated. You are free to change this value.
|
*/
'home' => RouteServiceProvider::HOME,
/*
|--------------------------------------------------------------------------
| Fortify Routes Prefix / Subdomain
|--------------------------------------------------------------------------
|
| Here you may specify which prefix Fortify will assign to all the routes
| that it registers with the application. If necessary, you may change
| subdomain under which all of the Fortify routes will be available.
|
*/
'prefix' => '',
'domain' => null,
/*
|--------------------------------------------------------------------------
| Fortify Routes Middleware
|--------------------------------------------------------------------------
|
| Here you may specify which middleware Fortify will assign to the routes
| that it registers with the application. If necessary, you may change
| these middleware but typically this provided default is preferred.
|
*/
'middleware' => ['web'],
/*
|--------------------------------------------------------------------------
| Rate Limiting
|--------------------------------------------------------------------------
|
| By default, Fortify will throttle logins to five requests per minute for
| every email and IP address combination. However, if you would like to
| specify a custom rate limiter to call then you may specify it here.
|
*/
'limiters' => [
'login' => 'login',
'two-factor' => 'two-factor',
],
/*
|--------------------------------------------------------------------------
| Register View Routes
|--------------------------------------------------------------------------
|
| Here you may specify if the routes returning views should be disabled as
| you may not need them when building your own application. This may be
| especially true if you're writing a custom single-page application.
|
*/
'views' => true,
/*
|--------------------------------------------------------------------------
| Features
|--------------------------------------------------------------------------
|
| Some of the Fortify features are optional. You may disable the features
| by removing them from this array. You're free to only remove some of
| these features or you can even remove all of these if you need to.
|
*/
'features' => [
Features::registration(),
Features::resetPasswords(),
Features::emailVerification(),
Features::updateProfileInformation(),
Features::updatePasswords(),
Features::twoFactorAuthentication([
'confirm' => true,
'confirmPassword' => true,
// 'window' => 0,
]),
],
];

52
config/hashing.php Normal file
View File

@ -0,0 +1,52 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Hash Driver
|--------------------------------------------------------------------------
|
| This option controls the default hash driver that will be used to hash
| passwords for your application. By default, the bcrypt algorithm is
| used; however, you remain free to modify this option if you wish.
|
| Supported: "bcrypt", "argon", "argon2id"
|
*/
'driver' => 'bcrypt',
/*
|--------------------------------------------------------------------------
| Bcrypt Options
|--------------------------------------------------------------------------
|
| Here you may specify the configuration options that should be used when
| passwords are hashed using the Bcrypt algorithm. This will allow you
| to control the amount of time it takes to hash the given password.
|
*/
'bcrypt' => [
'rounds' => env('BCRYPT_ROUNDS', 10),
],
/*
|--------------------------------------------------------------------------
| Argon Options
|--------------------------------------------------------------------------
|
| Here you may specify the configuration options that should be used when
| passwords are hashed using the Argon algorithm. These will allow you
| to control the amount of time it takes to hash the given password.
|
*/
'argon' => [
'memory' => 65536,
'threads' => 1,
'time' => 4,
],
];

81
config/jetstream.php Normal file
View File

@ -0,0 +1,81 @@
<?php
use Laravel\Jetstream\Features;
use Laravel\Jetstream\Http\Middleware\AuthenticateSession;
return [
/*
|--------------------------------------------------------------------------
| Jetstream Stack
|--------------------------------------------------------------------------
|
| This configuration value informs Jetstream which "stack" you will be
| using for your application. In general, this value is set for you
| during installation and will not need to be changed after that.
|
*/
'stack' => 'livewire',
/*
|--------------------------------------------------------------------------
| Jetstream Route Middleware
|--------------------------------------------------------------------------
|
| Here you may specify which middleware Jetstream will assign to the routes
| that it registers with the application. When necessary, you may modify
| these middleware; however, this default value is usually sufficient.
|
*/
'middleware' => ['web'],
'auth_session' => AuthenticateSession::class,
/*
|--------------------------------------------------------------------------
| Jetstream Guard
|--------------------------------------------------------------------------
|
| Here you may specify the authentication guard Jetstream will use while
| authenticating users. This value should correspond with one of your
| guards that is already present in your "auth" configuration file.
|
*/
'guard' => 'sanctum',
/*
|--------------------------------------------------------------------------
| Features
|--------------------------------------------------------------------------
|
| Some of Jetstream's features are optional. You may disable the features
| by removing them from this array. You're free to only remove some of
| these features or you can even remove all of these if you need to.
|
*/
'features' => [
// Features::termsAndPrivacyPolicy(),
// Features::profilePhotos(),
// Features::api(),
// Features::teams(['invitations' => true]),
Features::accountDeletion(),
],
/*
|--------------------------------------------------------------------------
| Profile Photo Disk
|--------------------------------------------------------------------------
|
| This configuration value determines the default disk that will be used
| when storing profile photos for your application's users. Typically
| this will be the "public" disk but you may adjust this if needed.
|
*/
'profile_photo_disk' => 'public',
];

131
config/logging.php Normal file
View File

@ -0,0 +1,131 @@
<?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 gets used when writing
| messages to the logs. The name specified in this option should match
| one of the channels defined in the "channels" configuration array.
|
*/
'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' => false,
],
/*
|--------------------------------------------------------------------------
| Log Channels
|--------------------------------------------------------------------------
|
| Here you may configure the log channels for your application. Out of
| the box, Laravel uses the Monolog PHP logging library. This gives
| you a variety of powerful log handlers / formatters to utilize.
|
| Available Drivers: "single", "daily", "slack", "syslog",
| "errorlog", "monolog",
| "custom", "stack"
|
*/
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => ['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' => 14,
'replace_placeholders' => true,
],
'slack' => [
'driver' => 'slack',
'url' => env('LOG_SLACK_WEBHOOK_URL'),
'username' => 'Laravel Log',
'emoji' => ':boom:',
'level' => env('LOG_LEVEL', 'critical'),
'replace_placeholders' => true,
],
'papertrail' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class),
'handler_with' => [
'host' => env('PAPERTRAIL_URL'),
'port' => env('PAPERTRAIL_PORT'),
'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'),
],
'processors' => [PsrLogMessageProcessor::class],
],
'stderr' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => StreamHandler::class,
'formatter' => env('LOG_STDERR_FORMATTER'),
'with' => [
'stream' => 'php://stderr',
],
'processors' => [PsrLogMessageProcessor::class],
],
'syslog' => [
'driver' => 'syslog',
'level' => env('LOG_LEVEL', 'debug'),
'facility' => 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'),
],
],
];

125
config/mail.php Normal file
View File

@ -0,0 +1,125 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Mailer
|--------------------------------------------------------------------------
|
| This option controls the default mailer that is used to send any email
| messages sent by your application. Alternative mailers may be setup
| and used as needed; however, this mailer will be used by default.
|
*/
'default' => env('MAIL_MAILER', 'smtp'),
/*
|--------------------------------------------------------------------------
| 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 to be used while
| sending an e-mail. You will specify which one you are using for your
| mailers below. You are free to add additional mailers as required.
|
| Supported: "smtp", "sendmail", "mailgun", "ses", "ses-v2",
| "postmark", "log", "array", "failover"
|
*/
'mailers' => [
'smtp' => [
'transport' => 'smtp',
'url' => env('MAIL_URL'),
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
'port' => env('MAIL_PORT', 587),
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'timeout' => null,
'local_domain' => env('MAIL_EHLO_DOMAIN'),
],
'ses' => [
'transport' => 'ses',
],
'mailgun' => [
'transport' => 'mailgun',
// 'client' => [
// 'timeout' => 5,
// ],
],
'postmark' => [
'transport' => 'postmark',
// 'client' => [
// 'timeout' => 5,
// ],
],
'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',
],
],
],
/*
|--------------------------------------------------------------------------
| Global "From" Address
|--------------------------------------------------------------------------
|
| You may wish for all e-mails 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 e-mails that are sent by your application.
|
*/
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'karismaagustiningtyas22@gmail.com'),
'name' => env('MAIL_FROM_NAME', 'Hello Laravel'),
],
/*
|--------------------------------------------------------------------------
| Markdown Mail Settings
|--------------------------------------------------------------------------
|
| If you are using Markdown based email rendering, you may configure your
| theme and component paths here, allowing you to customize the design
| of the emails. Or, you may simply stick with the Laravel defaults!
|
*/
'markdown' => [
'theme' => 'default',
'paths' => [
resource_path('views/vendor/mail'),
],
],
];

109
config/queue.php Normal file
View File

@ -0,0 +1,109 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Queue Connection Name
|--------------------------------------------------------------------------
|
| Laravel's queue API supports an assortment of back-ends via a single
| API, giving you convenient access to each back-end using the same
| syntax for every one. Here you may define a default connection.
|
*/
'default' => env('QUEUE_CONNECTION', 'sync'),
/*
|--------------------------------------------------------------------------
| Queue Connections
|--------------------------------------------------------------------------
|
| Here you may configure the connection information for each server that
| is used by your application. A default configuration has been added
| for each back-end shipped with Laravel. You are free to add more.
|
| Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null"
|
*/
'connections' => [
'sync' => [
'driver' => 'sync',
],
'database' => [
'driver' => 'database',
'table' => 'jobs',
'queue' => 'default',
'retry_after' => 90,
'after_commit' => false,
],
'beanstalkd' => [
'driver' => 'beanstalkd',
'host' => 'localhost',
'queue' => 'default',
'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' => 'default',
'queue' => env('REDIS_QUEUE', 'default'),
'retry_after' => 90,
'block_for' => null,
'after_commit' => false,
],
],
/*
|--------------------------------------------------------------------------
| Job Batching
|--------------------------------------------------------------------------
|
| The following options configure the database and table that store job
| batching information. These options can be updated to any database
| connection and table which has been defined by your application.
|
*/
'batching' => [
'database' => env('DB_CONNECTION', 'mysql'),
'table' => 'job_batches',
],
/*
|--------------------------------------------------------------------------
| Failed Queue Jobs
|--------------------------------------------------------------------------
|
| These options configure the behavior of failed queue job logging so you
| can control which database and table are used to store the jobs that
| have failed. You may change them to any database / table you wish.
|
*/
'failed' => [
'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'),
'database' => env('DB_CONNECTION', 'mysql'),
'table' => 'failed_jobs',
],
];

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