public function add_comments($type, $type_no, $date_, $memo_) { if ($memo_ != null && $memo_ != "") { $comment = new PahComments(); $comment->type = $type; $comment->type_no = $type_no; $comment->date_ = $date_; $comment->memo_ = $memo_; if (!$comment->save()) { throw new Exception("Gagal menyimpan keterangan."); } } }