public function check_ledger_code() { $this->verify_nonce('erp-ac-nonce'); $code = isset($_POST['code']) ? intval($_POST['code']) : ''; if (Model\Ledger::code($code)->get()->first() === null) { $this->send_success(); } $this->send_error(); }