insert('change_log', array( 'user' => $_POST['user'], 'table_' => 'documents', 'action' => $action, 'values' => json_encode($values), 'row' => $id //'when' => date('c') )); } $docId = $_POST['doc_id']; Editor::inst($db, 'table_of_content') -> where('table_of_content.doc_id', $docId ) // ->where(function($q) use ($docId) { // $q->where('table_of_content.doc_id', $docId); // }) ->fields( Field::inst('table_of_content.id'), Field::inst('table_of_content.document'), Field::inst('table_of_content.number'), Field::inst('table_of_content.doc_id'), ) ->on('postCreate', function ($editor, $id, &$values, &$row) { logChange($editor->db(), 'create', $id, $values); }) ->on('postEdit', function ($editor, $id, &$values, &$row) { logChange($editor->db(), 'edit', $id, $values); }) // ->leftJoin('city', 'city.id', '=', 'documents.city') // ->leftJoin('province', 'province.id', '=', 'documents.province') // ->leftJoin('region', 'region.id', '=', 'documents.region') // ->leftJoin('unit', 'unit.id', '=', 'documents.unit') // ->leftJoin('department', 'department.id', '=', 'documents.department') // ->leftJoin('company', 'company.id', '=', 'documents.company') // ->leftJoin('type', 'type.id', '=', 'documents.type') ->process($_POST) ->json();