| 1 |
<?php |
| 2 |
|
| 3 |
namespace WeDevs\ERP\Accounting\API; |
| 4 |
|
| 5 |
/** |
| 6 |
* class REST_API Handler |
| 7 |
*/ |
| 8 |
class REST_API { |
| 9 |
public function __construct() { |
| 10 |
add_filter( 'erp_rest_api_controllers', [ $this, 'register_accounting_new_controllers' ] ); |
| 11 |
} |
| 12 |
|
| 13 |
public function register_accounting_new_controllers( $controllers ) { |
| 14 |
$this->include_controllers(); |
| 15 |
|
| 16 |
$controllers = array_merge( |
| 17 |
$controllers, |
| 18 |
[ |
| 19 |
'\WeDevs\ERP\Accounting\API\Customers_Controller', |
| 20 |
'\WeDevs\ERP\Accounting\API\Vendors_Controller', |
| 21 |
'\WeDevs\ERP\Accounting\API\Employees_Controller', |
| 22 |
'\WeDevs\ERP\Accounting\API\Inventory_Products_Controller', |
| 23 |
'\WeDevs\ERP\Accounting\API\Inventory_Product_Cats_Controller', |
| 24 |
'\WeDevs\ERP\Accounting\API\Ledgers_Accounts_Controller', |
| 25 |
'\WeDevs\ERP\Accounting\API\Opening_Balances_Controller', |
| 26 |
'\WeDevs\ERP\Accounting\API\Closing_Balance_Controller', |
| 27 |
'\WeDevs\ERP\Accounting\API\Invoices_Controller', |
| 28 |
'\WeDevs\ERP\Accounting\API\Payments_Controller', |
| 29 |
'\WeDevs\ERP\Accounting\API\Bills_Controller', |
| 30 |
'\WeDevs\ERP\Accounting\API\Pay_Bills_Controller', |
| 31 |
'\WeDevs\ERP\Accounting\API\Purchases_Controller', |
| 32 |
'\WeDevs\ERP\Accounting\API\Pay_Purchases_Controller', |
| 33 |
'\WeDevs\ERP\Accounting\API\Transactions_Controller', |
| 34 |
'\WeDevs\ERP\Accounting\API\Tax_Rates_Controller', |
| 35 |
'\WeDevs\ERP\Accounting\API\Bank_Accounts_Controller', |
| 36 |
'\WeDevs\ERP\Accounting\API\Company_Controller', |
| 37 |
'\WeDevs\ERP\Accounting\API\Currencies_Controller', |
| 38 |
'\WeDevs\ERP\Accounting\API\Journals_Controller', |
| 39 |
'\WeDevs\ERP\Accounting\API\Expenses_Controller', |
| 40 |
'\WeDevs\ERP\Accounting\API\Tax_Agencies_Controller', |
| 41 |
'\WeDevs\ERP\Accounting\API\Tax_Cats_Controller', |
| 42 |
'\WeDevs\ERP\Accounting\API\Tax_Rate_Names_Controller', |
| 43 |
'\WeDevs\ERP\Accounting\API\People_Controller', |
| 44 |
'\WeDevs\ERP\Accounting\API\Reports_Controller', |
| 45 |
] |
| 46 |
); |
| 47 |
|
| 48 |
return $controllers; |
| 49 |
} |
| 50 |
|
| 51 |
public function include_controllers() { |
| 52 |
foreach ( glob( ERP_ACCOUNTING_API . '/*.php' ) as $filename ) { |
| 53 |
include_once $filename; |
| 54 |
} |
| 55 |
} |
| 56 |
} |
| 57 |
|