KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

How to call the particular function from multiple functions of a single class #2130

Open Abhishek opened this topic on on Jun 8, 2021 - 4 comments

Abhishek commented on Jun 8, 2021

Dear Team, I have implemented the following code in order to optimize the code. I have taken a min class and I have implemented the methods of all other class.

So now how should I call those multiple functions which have implemented in a single class.

<?php

use \koolreport\dashboard\metrics\Value;
use \koolreport\dashboard\fields\Date;
use \koolreport\dashboard\fields\Number;

class patient_main
{
	//enquires.php
protected function dataSource()
    {
        return AutoMaker::table("tablename");
    }

    protected function fields()
    {
        return [
            Date::create("custCreatedDate"),
            $this->count(
                Number::create("custEnquiryId")
            )
        ];
		
    }
	//appointments.php
	protected function dataSource()
    {
        return AutoMaker::table("tblconsultation");
    }

    protected function fields()
    {
        return [
            Date::create("appointmentDate"),
            $this->count(
                Number::create("appointmentDate")
            )
        ];
	
    }
	
}
Abhishek commented on Jun 8, 2021

Dear Team, Please help me how to call the particular method.

KoolReport commented on Jun 8, 2021

Don't do that, it will not work. Please tell me what you are trying to complete. What is the problem you want to solve?

Abhishek commented on Jun 9, 2021

Dear Team, Actually I am creating individual class for enquires, Appointments, visits, consultations and etc but my boss had suggested me that why are you creating individual class? and why can't you create a main class and implement those methods in that class call those functions.

Instead of creating individual class create a single class and implement those methods and call those functions this was my boos idea.

Abhishek commented on Jun 10, 2021

Dear Team, Actually I am creating individual class for enquires, Appointments, visits, consultations and etc but my boss had suggested me that why are you creating individual class? and why can't you create a main class and implement those methods in that class call those functions.

Instead of creating individual class create a single class and implement those methods and call those functions this was my boos idea.

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
help needed

Dashboard