/** * Get dependents * * @return array */ public function get_dependents() { return Dependents::where('employee_id', '=', $this->id)->get(); }
/** * Delete a dependent * * @return void */ public function employee_dependent_delete() { $this->verify_nonce('wp-erp-hr-nonce'); // @TODO: check permission $id = isset($_POST['id']) ? intval($_POST['id']) : 0; if ($id) { Dependents::find($id)->delete(); } $this->send_success(); }