private function getIdentitasMahasiswa() { $code = $this->property('code'); $no_pendaftaran = substr($code, 0, 6); $kode_generate = str_replace($no_pendaftaran, "", $code); $mahasiswa = IdentitasMahasiswa::with('program_pendidikan')->where('no_pendaftaran', $no_pendaftaran)->where('kode_generate', $kode_generate)->first(); return $mahasiswa; }
public function exportData($columns, $sessionKey = null) { $mhs = IdentitasMahasiswa::all(); $mhs->each(function ($mhs) use($columns) { $mhs->addVisible($columns); }); return $mhs->toArray(); }
private function autonumber($kolom, $lebar = 0, $awalan = '') { $mhs = IdentitasMahasiswa::orderBy($kolom, 'desc'); $jumlah = $mhs->count(); if ($jumlah == 0) { $nomor = 1; } else { $row = $mhs->first()->toArray(); $nomor = intval(substr($row[$kolom], strlen($awalan))) + 1; } if ($lebar > 0) { $angka = $awalan . str_pad($nomor, $lebar, "0", STR_PAD_LEFT); } else { $angka = $awalan . $nomor; } return $angka; }