Ejemplo n.º 1
0
 function delete($id)
 {
     $topic = new Topic($id);
     $question = new Questionaire();
     $answer = new Answer();
     $answer->where_related('questionaire', 'topic_id', $id)->get()->delete_all();
     $choice = new Choice();
     $choice->where_related('questionaire', 'topic_id', $id)->get()->delete_all();
     $question->where('topic_id', $id)->get()->delete_all();
     $topic->delete();
     set_notify('success', 'ลบข้อมูลเรียบร้อยแล้วค่ะ');
     redirect($_SERVER['HTTP_REFERER']);
 }