/** * Tidak diperbolehkan mengedit atau menghapus record yg sudah tersimpan * agar integrasi surat tidak kacau, kecuali untuk record terakhir saja. */ public static function update_petunjuk($input) { $petunjuk = $input['petunjuk']; // 'id' terakhir tidak diambil dari form, tetapi langsung dari query $id = Petunjuk::order_by('id', 'desc')->only('id'); Petunjuk::update($id, array('petunjuk' => $petunjuk)); // membuat message success $msg = 'Petunjuk: "' . $petunjuk . '" telah diupdate ke dalam daftar.'; return $msg; }
public function get_petunjuk() { $db_petunjuk = Petunjuk::get(); $last_added_petunjuk = Petunjuk::order_by('id', 'desc')->only('petunjuk'); return View::make('settings.petunjuk')->with('title', 'Agenda Surat :: Settings')->with('db_petunjuk', $db_petunjuk)->with('last_added_petunjuk', $last_added_petunjuk); }