636 lines
20 KiB
PHP
636 lines
20 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Models\Alternatif;
|
|
use Illuminate\Http\Request;
|
|
use App\Models\Form;
|
|
use Illuminate\Support\Facades\DB;
|
|
// use Illuminate\Support\Facades\Response;
|
|
|
|
class CountController extends Controller
|
|
{
|
|
public function index()
|
|
{
|
|
// $data['mhs'] = DB::table('mahasiswa')->get();
|
|
$count = DB::table('form')
|
|
// ->join('alternatif', 'alternatif.id_form', '=', 'form.id')
|
|
->orderBy('form.id', 'DESC')
|
|
->where('form.status', '!=', '0')
|
|
->get();
|
|
|
|
$data = [
|
|
'count' => $count,
|
|
];
|
|
|
|
return view('backend.hitung.index', $data);
|
|
}
|
|
|
|
function reset_pengangsuran($id)
|
|
{
|
|
$form = Form::find($id);
|
|
|
|
$form->kuota_pengangsuran = null;
|
|
$form->save();
|
|
|
|
$alternatif = DB::table('alternatif')
|
|
->where('id_form', '=', $form->id)
|
|
->where('nilai', '!=', '')
|
|
->where('status', '!=', '0')
|
|
->where('jenis', '=', 'Pengangsuran UKT')
|
|
->where('dokumen', '!=', '')
|
|
->get();
|
|
|
|
for ($i = 0; $i < count($alternatif); $i++) {
|
|
$alt = Alternatif::find($alternatif[$i]->id);
|
|
$alt->status = '0';
|
|
date_default_timezone_set('Asia/Jakarta');
|
|
$alt->tgl_status = date('Y-m-d H:i:s');
|
|
$alt->save();
|
|
}
|
|
|
|
return redirect()->route('formulir')->with(['success' => 'Reset Jumlah Kuota Penerima Berhasil!']);
|
|
}
|
|
|
|
function reset_penurunan($id)
|
|
{
|
|
$form = Form::find($id);
|
|
|
|
$form->kuota_penurunan = null;
|
|
$form->save();
|
|
|
|
$alternatif = DB::table('alternatif')
|
|
->where('id_form', '=', $form->id)
|
|
->where('nilai', '!=', '')
|
|
->where('status', '!=', '0')
|
|
->where('jenis', '=', 'Penurunan UKT')
|
|
->where('dokumen', '!=', '')
|
|
->get();
|
|
|
|
for ($i = 0; $i < count($alternatif); $i++) {
|
|
$alt = Alternatif::find($alternatif[$i]->id);
|
|
$alt->status = '0';
|
|
date_default_timezone_set('Asia/Jakarta');
|
|
$alt->tgl_status = date('Y-m-d H:i:s');
|
|
$alt->save();
|
|
}
|
|
|
|
return redirect()->route('formulir')->with(['success' => 'Reset Jumlah Kuota Penerima Berhasil!']);
|
|
}
|
|
|
|
function kuota_pengangsuran(Request $request)
|
|
{
|
|
$request->validate([
|
|
'kuota' => 'required',
|
|
], [
|
|
'kuota.required' => 'Kuota wajib diisi'
|
|
]);
|
|
|
|
$form = Form::find($request->id_kuota);
|
|
|
|
$form->kuota_pengangsuran = $request->kuota;
|
|
$form->save();
|
|
|
|
$alternatif = DB::table('alternatif')
|
|
->where('id_form', '=', $request->id_kuota)
|
|
->where('nilai', '!=', '')
|
|
->where('jenis', '=', 'Pengangsuran UKT')
|
|
->where('dokumen', '!=', '')
|
|
->get();
|
|
|
|
for ($i = 0; $i < count($alternatif); $i++) {
|
|
if ($i < $request->kuota) {
|
|
$status = '1';
|
|
} else {
|
|
$status = '2';
|
|
}
|
|
|
|
$alt = Alternatif::find($alternatif[$i]->id);
|
|
$alt->status = $status;
|
|
date_default_timezone_set('Asia/Jakarta');
|
|
$alt->tgl_status = date('Y-m-d H:i:s');
|
|
$alt->save();
|
|
}
|
|
|
|
return redirect()->route('hasil')->with(['success' => 'Setting Jumlah Kuota Penerima Berhasil!']);
|
|
}
|
|
|
|
function kuota_penurunan(Request $request)
|
|
{
|
|
$request->validate([
|
|
'kuota' => 'required',
|
|
], [
|
|
'kuota.required' => 'Kuota wajib diisi'
|
|
]);
|
|
|
|
$form = Form::find($request->id_kuota);
|
|
|
|
$form->kuota_penurunan = $request->kuota;
|
|
$form->save();
|
|
|
|
$alternatif = DB::table('alternatif')
|
|
->where('id_form', '=', $request->id_kuota)
|
|
->where('nilai', '!=', '')
|
|
->where('jenis', '=', 'Penurunan UKT')
|
|
->where('dokumen', '!=', '')
|
|
->get();
|
|
|
|
for ($i = 0; $i < count($alternatif); $i++) {
|
|
if ($i < $request->kuota) {
|
|
$status = '1';
|
|
} else {
|
|
$status = '2';
|
|
}
|
|
|
|
$alt = Alternatif::find($alternatif[$i]->id);
|
|
$alt->status = $status;
|
|
date_default_timezone_set('Asia/Jakarta');
|
|
$alt->tgl_status = date('Y-m-d H:i:s');
|
|
$alt->save();
|
|
}
|
|
|
|
return redirect()->route('hasil')->with(['success' => 'Setting Jumlah Kuota Penerima Berhasil!']);
|
|
}
|
|
|
|
function alasan(Request $request)
|
|
{
|
|
$request->validate([
|
|
'alasan' => 'required',
|
|
], [
|
|
'alasan.required' => 'Alasan Validasi wajib diisi'
|
|
]);
|
|
|
|
$valid = Alternatif::find($request->id_alasan);
|
|
|
|
$valid->alasan_validasi = $request->alasan;
|
|
$valid->save();
|
|
|
|
return redirect()->back()->with(['success' => 'Alasan Validasi berhasil ditambahkan!']);
|
|
}
|
|
|
|
function val_yes($id)
|
|
{
|
|
$alt = Alternatif::find($id);
|
|
$alt->valid = '1';
|
|
date_default_timezone_set('Asia/Jakarta');
|
|
$alt->tgl_valid = date('Y-m-d H:i:s');
|
|
$alt->save();
|
|
|
|
return redirect()->back()->with(['success' => 'Validasi Sudah Dilakukan!']);
|
|
}
|
|
|
|
function val_no($id)
|
|
{
|
|
$alt = Alternatif::find($id);
|
|
$alt->valid = '2';
|
|
$alt->status = '2';
|
|
date_default_timezone_set('Asia/Jakarta');
|
|
$alt->tgl_valid = date('Y-m-d H:i:s');
|
|
$alt->save();
|
|
|
|
return redirect()->back()->with(['success' => 'Validasi Sudah Dilakukan!']);
|
|
}
|
|
|
|
public function hasil()
|
|
{
|
|
$hasil = DB::table('form')
|
|
->where('form.status', '=', '2')
|
|
->orderByDesc('form.id')
|
|
->get();
|
|
|
|
$data = [
|
|
'hasil' => $hasil,
|
|
];
|
|
|
|
return view('backend.hitung.hasil', $data);
|
|
}
|
|
|
|
public function final_penurunan($id)
|
|
{
|
|
$alternatif = DB::table('alternatif')
|
|
->join('mahasiswa', 'alternatif.id_mahasiswa', '=', 'mahasiswa.id')
|
|
->join('jurusan', 'mahasiswa.id_jurusan', '=', 'jurusan.id')
|
|
->join('prodi', 'mahasiswa.id_prodi', '=', 'prodi.id')
|
|
->join('form', 'alternatif.id_form', '=', 'form.id')
|
|
->select('alternatif.*', 'mahasiswa.*', 'jurusan.*', 'prodi.*')
|
|
->where('form.id', '=', $id)
|
|
->where('alternatif.status', '!=', "0")
|
|
->where('alternatif.valid', '=', "1")
|
|
->where('jenis', '=', 'Penurunan UKT')
|
|
->orderByRaw('alternatif.status')
|
|
// ->where('alternatif.sub_bobot', '!=', '')
|
|
->get();
|
|
|
|
$form = DB::table('form')
|
|
->where('id', '=', $id)->first();
|
|
|
|
$data = [
|
|
'alternatif' => $alternatif,
|
|
'id_form' => $form->id,
|
|
'nama_form' => $form->nama_form,
|
|
'kuota_form' => $form->kuota_penurunan,
|
|
'dibuat' => $form->created_at,
|
|
];
|
|
|
|
return view('backend.hitung.final', $data);
|
|
}
|
|
|
|
public function final_pengangsuran($id)
|
|
{
|
|
$alternatif = DB::table('alternatif')
|
|
->join('mahasiswa', 'alternatif.id_mahasiswa', '=', 'mahasiswa.id')
|
|
->join('jurusan', 'mahasiswa.id_jurusan', '=', 'jurusan.id')
|
|
->join('prodi', 'mahasiswa.id_prodi', '=', 'prodi.id')
|
|
->join('form', 'alternatif.id_form', '=', 'form.id')
|
|
->select('alternatif.*', 'mahasiswa.*', 'jurusan.*', 'prodi.*')
|
|
->where('form.id', '=', $id)
|
|
->where('alternatif.status', '!=', "0")
|
|
->where('alternatif.valid', '=', "1")
|
|
->where('jenis', '=', 'Pengangsuran UKT')
|
|
->orderByRaw('alternatif.status')
|
|
// ->where('alternatif.sub_bobot', '!=', '')
|
|
->get();
|
|
|
|
$form = DB::table('form')
|
|
->where('id', '=', $id)->first();
|
|
|
|
$data = [
|
|
'alternatif' => $alternatif,
|
|
'id_form' => $form->id,
|
|
'nama_form' => $form->nama_form,
|
|
'kuota_form' => $form->kuota_pengangsuran,
|
|
'dibuat' => $form->created_at,
|
|
];
|
|
|
|
return view('backend.hitung.final', $data);
|
|
}
|
|
|
|
// public function download($dokumen)
|
|
// {
|
|
// $get_data = DB::table('alternatif')->where('dokumen', '=', "$dokumen")->first();
|
|
// $dok = $get_data->dokumen;
|
|
// // $path = public_path('/document/accounts/', $get_data->dokumen);
|
|
// // $header = ['Content-Type: application/pdf'];
|
|
|
|
// $file = public_path() . "/document/accounts/$dok";
|
|
|
|
// $headers = array(
|
|
// 'Content-Type: application/pdf',
|
|
// );
|
|
|
|
// // return Response::download($file, "$get_data->dokumen", $headers);
|
|
|
|
// return Response::download($path);
|
|
// }
|
|
|
|
public function penurunan($id)
|
|
{
|
|
$alternatif = DB::table('alternatif')
|
|
->join('mahasiswa', 'alternatif.id_mahasiswa', '=', 'mahasiswa.id')
|
|
->join('jurusan', 'mahasiswa.id_jurusan', '=', 'jurusan.id')
|
|
->join('prodi', 'mahasiswa.id_prodi', '=', 'prodi.id')
|
|
// ->join('form', 'alternatif.id_form', '=', 'form.id')
|
|
->select(
|
|
'alternatif.*',
|
|
'mahasiswa.nim',
|
|
'mahasiswa.nama',
|
|
'jurusan.nama_jurusan',
|
|
'prodi.nama_prodi',
|
|
'mahasiswa.angkatan',
|
|
'mahasiswa.semester',
|
|
'mahasiswa.jalur_masuk',
|
|
'mahasiswa.ukt_sekarang',
|
|
'mahasiswa.ponsel',
|
|
'mahasiswa.alamat'
|
|
)
|
|
->orderBy('alternatif.id', 'DESC')
|
|
->where('alternatif.id_form', '=', $id)
|
|
->where('alternatif.sub_bobot', '!=', '')
|
|
->where('jenis', '=', 'Penurunan UKT')
|
|
->get();
|
|
|
|
$form = DB::table('form')
|
|
->where('id', '=', $id)->first();
|
|
$kriteria = DB::table('kriteria')->orderByDesc('bobot')->get();
|
|
|
|
foreach ($kriteria as $k) {
|
|
$subQuery[] = DB::table('sub')->where('id_kriteria', '=', $k->id)->orderBy('sub.bobot', 'ASC')->get();
|
|
}
|
|
|
|
$data = [
|
|
'alternatif' => $alternatif,
|
|
'kriteria' => $kriteria,
|
|
'sub' => $subQuery,
|
|
'id_form' => $form->id,
|
|
'nama_form' => $form->nama_form,
|
|
'dibuat' => $form->created_at,
|
|
];
|
|
// $data['nama_form'] = $data['alternatif']->nama_form;
|
|
return view('backend.hitung.detail', $data);
|
|
}
|
|
|
|
public function pengangsuran($id)
|
|
{
|
|
$alternatif = DB::table('alternatif')
|
|
->join('mahasiswa', 'alternatif.id_mahasiswa', '=', 'mahasiswa.id')
|
|
->join('jurusan', 'mahasiswa.id_jurusan', '=', 'jurusan.id')
|
|
->join('prodi', 'mahasiswa.id_prodi', '=', 'prodi.id')
|
|
->select(
|
|
'alternatif.*',
|
|
'mahasiswa.nim',
|
|
'mahasiswa.nama',
|
|
'jurusan.nama_jurusan',
|
|
'prodi.nama_prodi',
|
|
'mahasiswa.angkatan',
|
|
'mahasiswa.semester',
|
|
'mahasiswa.jalur_masuk',
|
|
'mahasiswa.ukt_sekarang',
|
|
'mahasiswa.ponsel',
|
|
'mahasiswa.alamat'
|
|
)
|
|
->orderBy('alternatif.id', 'DESC')
|
|
->where('alternatif.id_form', '=', $id)
|
|
->where('alternatif.sub_bobot', '!=', '')
|
|
->where('jenis', '=', 'Pengangsuran UKT')
|
|
->get();
|
|
|
|
$form = DB::table('form')
|
|
->where('id', '=', $id)->first();
|
|
$kriteria = DB::table('kriteria')->orderByDesc('bobot')->get();
|
|
|
|
foreach ($kriteria as $k) {
|
|
$subQuery[] = DB::table('sub')->where('id_kriteria', '=', $k->id)->orderBy('sub.bobot', 'ASC')->get();
|
|
}
|
|
|
|
$data = [
|
|
'alternatif' => $alternatif,
|
|
'kriteria' => $kriteria,
|
|
'sub' => $subQuery,
|
|
'id_form' => $form->id,
|
|
'nama_form' => $form->nama_form,
|
|
'dibuat' => $form->created_at,
|
|
];
|
|
// $data['nama_form'] = $data['alternatif']->nama_form;
|
|
return view('backend.hitung.detail', $data);
|
|
}
|
|
|
|
function close($id)
|
|
{
|
|
$form = Form::find($id);
|
|
$form->status = '2';
|
|
$form->save();
|
|
|
|
return redirect()->route('hitung')->with(['success' => 'Edit Formulir Berhasil!']);
|
|
}
|
|
|
|
function open($id)
|
|
{
|
|
$form = Form::find($id);
|
|
$form->status = '1';
|
|
$form->save();
|
|
|
|
return redirect()->route('hitung')->with(['success' => 'Edit Formulir Berhasil!']);
|
|
}
|
|
|
|
public function sort_pengangsuran($id)
|
|
{
|
|
$alternatif = DB::table('alternatif')
|
|
->join('mahasiswa', 'alternatif.id_mahasiswa', '=', 'mahasiswa.id')
|
|
->join('jurusan', 'mahasiswa.id_jurusan', '=', 'jurusan.id')
|
|
->join('prodi', 'mahasiswa.id_prodi', '=', 'prodi.id')
|
|
->join('form', 'alternatif.id_form', '=', 'form.id')
|
|
->where('form.id', '=', $id)
|
|
->where('valid', '=', '1')
|
|
->where('alternatif.status', '=', '0')
|
|
->where('alternatif.jenis', '=', 'Pengangsuran UKT')
|
|
->orderByDesc('alternatif.nilai')
|
|
// ->where('alternatif.sub_bobot', '!=', '')
|
|
->get();
|
|
|
|
$form = DB::table('form')
|
|
->where('id', '=', $id)->first();
|
|
|
|
$kriteria = DB::table('kriteria')->orderByDesc('bobot')->get();
|
|
|
|
foreach ($kriteria as $k) {
|
|
$subQuery[] = DB::table('sub')->where('id_kriteria', '=', $k->id)->orderBy('sub.bobot', 'ASC')->get();
|
|
}
|
|
|
|
if (count($alternatif) != 0) {
|
|
foreach ($alternatif as $key) {
|
|
$jenis_ = $key->jenis;
|
|
}
|
|
} else {
|
|
$jenis_ = "Pengangsuran UKT";
|
|
}
|
|
|
|
// $kuota_ = null;
|
|
|
|
if ($jenis_ == "Pengangsuran UKT") {
|
|
$kuota_ = $form->kuota_pengangsuran;
|
|
}
|
|
|
|
$data = [
|
|
'alternatif' => $alternatif,
|
|
'kriteria' => $kriteria,
|
|
'sub' => $subQuery,
|
|
'id_form' => $form->id,
|
|
'nama_form' => $form->nama_form,
|
|
'jenis_form' => $jenis_,
|
|
'kuota_form' => $kuota_,
|
|
'dibuat' => $form->created_at,
|
|
];
|
|
// $data['nama_form'] = $data['alternatif']->nama_form;
|
|
return view('backend.hitung.sort', $data);
|
|
}
|
|
|
|
public function sort_penurunan($id)
|
|
{
|
|
$alternatif = DB::table('alternatif')
|
|
->join('mahasiswa', 'alternatif.id_mahasiswa', '=', 'mahasiswa.id')
|
|
->join('jurusan', 'mahasiswa.id_jurusan', '=', 'jurusan.id')
|
|
->join('prodi', 'mahasiswa.id_prodi', '=', 'prodi.id')
|
|
->join('form', 'alternatif.id_form', '=', 'form.id')
|
|
->where('form.id', '=', $id)
|
|
->where('valid', '=', '1')
|
|
->where('alternatif.status', '=', '0')
|
|
->where('alternatif.jenis', '=', 'Penurunan UKT')
|
|
->orderByDesc('alternatif.nilai')
|
|
// ->where('alternatif.sub_bobot', '!=', '')
|
|
->get();
|
|
|
|
$form = DB::table('form')
|
|
->where('id', '=', $id)->first();
|
|
|
|
$kriteria = DB::table('kriteria')->orderByDesc('bobot')->get();
|
|
|
|
foreach ($kriteria as $k) {
|
|
$subQuery[] = DB::table('sub')->where('id_kriteria', '=', $k->id)->orderBy('sub.bobot', 'ASC')->get();
|
|
}
|
|
|
|
|
|
if (count($alternatif) != 0) {
|
|
foreach ($alternatif as $key) {
|
|
$jenis = $key->jenis;
|
|
}
|
|
} else {
|
|
$jenis = "Penurunan UKT";
|
|
}
|
|
|
|
if ($jenis == "Penurunan UKT") {
|
|
$kuota = $form->kuota_penurunan;
|
|
}
|
|
|
|
$data = [
|
|
'alternatif' => $alternatif,
|
|
'kriteria' => $kriteria,
|
|
'sub' => $subQuery,
|
|
'id_form' => $form->id,
|
|
'nama_form' => $form->nama_form,
|
|
'jenis_form' => $jenis,
|
|
'kuota_form' => $kuota,
|
|
'dibuat' => $form->created_at,
|
|
];
|
|
// $data['nama_form'] = $data['alternatif']->nama_form;
|
|
return view('backend.hitung.sort', $data);
|
|
}
|
|
|
|
public function list()
|
|
{
|
|
$rank = DB::table('form')
|
|
// ->join('alternatif', 'form.id', '=', 'alternatif.id_form')
|
|
->where('form.status', '=', '2')
|
|
// ->where('alternatif.nilai', '!=', 0)
|
|
->orderByDesc('form.id')
|
|
->get();
|
|
|
|
$data = [
|
|
'rank' => $rank,
|
|
];
|
|
|
|
return view('backend.hitung.list', $data);
|
|
}
|
|
|
|
function rank_pengangsuran($id)
|
|
{
|
|
$form = DB::table('form')
|
|
->where('id', '=', $id)->first();
|
|
|
|
$id_form = $form->id;
|
|
|
|
$alt = DB::table('alternatif')
|
|
->where('id_form', '=', $id_form)
|
|
->where('jenis', '=', 'Pengangsuran UKT')
|
|
->where('valid', '=', "1")
|
|
->where('dokumen', '!=', "0")
|
|
->where('dokumen_pendukung', '!=', "0")
|
|
->get();
|
|
// $alt2 = DB::table('alternatif')
|
|
// ->where('id_form', '=', $id_form)
|
|
// ->where('jenis', '=', 'Pengangsuran UKT')
|
|
// // ->where('sub_input', '!=', 0)
|
|
// ->where('dokumen', '!=', 0)
|
|
// ->get();
|
|
|
|
$kriteria = DB::table('kriteria')->orderBy('bobot', 'DESC')->get();
|
|
|
|
if (count($alt) < 5) {
|
|
return redirect()->route('hitung')->with(['error' => 'Jumlah Pendaftar kurang memenuhi standar, minimal 5 Pendaftar!']);
|
|
} else {
|
|
for ($k = 0; $k < count($kriteria); $k++) {
|
|
$bobot[] = $kriteria[$k]->bobot;
|
|
}
|
|
|
|
for ($i = 0; $i < count($alt); $i++) {
|
|
$arr = json_encode($alt[$i]->sub_bobot);
|
|
$arr1[] = json_decode($arr);
|
|
$arr2[] = str_replace(array('"'), '', explode(',', $arr));
|
|
}
|
|
|
|
for ($a = 0; $a < count($arr2); $a++) {
|
|
for ($x = 0; $x < count($kriteria); $x++) {
|
|
$arr3[] = $arr2[$a][$x] * $bobot[$x];
|
|
}
|
|
}
|
|
|
|
$get = array_chunk($arr3, count($kriteria));
|
|
|
|
for ($g = 0; $g < count($get); $g++) {
|
|
$total = array_sum($get[$g]);
|
|
|
|
$id = $alt[$g]->id;
|
|
|
|
$nilai = Alternatif::find($id);
|
|
|
|
$nilai->nilai = $total;
|
|
date_default_timezone_set('Asia/Jakarta');
|
|
$nilai->tgl_hitung = date('Y-m-d H:i:s');
|
|
$nilai->save();
|
|
}
|
|
|
|
return redirect()->route('list')->with(['success' => 'Perhitungan Berhasil!']);
|
|
}
|
|
}
|
|
|
|
function rank_penurunan($id)
|
|
{
|
|
$form = DB::table('form')
|
|
->where('id', '=', $id)->first();
|
|
|
|
$id_form = $form->id;
|
|
|
|
$alt = DB::table('alternatif')
|
|
->where('id_form', '=', $id_form)
|
|
->where('jenis', '=', 'Penurunan UKT')
|
|
->where('valid', '=', "1")
|
|
->where('dokumen', '!=', "0")
|
|
->where('dokumen_pendukung', '!=', "0")
|
|
->get();
|
|
// $alt2 = DB::table('alternatif')
|
|
// ->where('id_form', '=', $id_form)
|
|
// ->where('jenis', '=', 'Pengangsuran UKT')
|
|
// // ->where('sub_input', '!=', 0)
|
|
// ->where('dokumen', '!=', 0)
|
|
// ->get();
|
|
|
|
$kriteria = DB::table('kriteria')->orderBy('bobot', 'DESC')->get();
|
|
|
|
if (count($alt) < 5) {
|
|
return redirect()->route('hitung')->with(['error' => 'Jumlah Pendaftar kurang memenuhi standar, minimal 5 Pendaftar!']);
|
|
} else {
|
|
for ($k = 0; $k < count($kriteria); $k++) {
|
|
$bobot[] = $kriteria[$k]->bobot;
|
|
}
|
|
|
|
for ($i = 0; $i < count($alt); $i++) {
|
|
$arr = json_encode($alt[$i]->sub_bobot);
|
|
$arr1[] = json_decode($arr);
|
|
$arr2[] = str_replace(array('"'), '', explode(',', $arr));
|
|
}
|
|
|
|
for ($a = 0; $a < count($arr2); $a++) {
|
|
for ($x = 0; $x < count($kriteria); $x++) {
|
|
$arr3[] = $arr2[$a][$x] * $bobot[$x];
|
|
}
|
|
}
|
|
|
|
$get = array_chunk($arr3, count($kriteria));
|
|
|
|
for ($g = 0; $g < count($get); $g++) {
|
|
$total = array_sum($get[$g]);
|
|
|
|
$id = $alt[$g]->id;
|
|
|
|
$nilai = Alternatif::find($id);
|
|
|
|
$nilai->nilai = $total;
|
|
date_default_timezone_set('Asia/Jakarta');
|
|
$nilai->tgl_hitung = date('Y-m-d H:i:s');
|
|
$nilai->save();
|
|
}
|
|
|
|
return redirect()->route('list')->with(['success' => 'Perhitungan Berhasil!']);
|
|
}
|
|
}
|
|
}
|