augustine jenin
augustine jenin

Reputation: 524

How to use the Whmcs getproducts function in Laravel

I have a Laravel project using the Whmcs integration. This is how whmcs is used:

Whmcs::getproducts([
            'pid' => 1,
        ]);

Where can I find the getproducts function? I searched the function name, but I couldn't find it in the package.

Upvotes: 0

Views: 719

Answers (2)

lagbox
lagbox

Reputation: 50491

There isn't such a method. The WhmcsManager class has a magic method __call that is being used. Any non accessible or not existing method calls will be handled by __call which will pass the method name and arguments to the execute method, which will make the API call with the action parameter set as the method name you called.

WhmcsManager@__call

WhmcsManager@execute

PHP Manual - Classes and Objects - Method Overloading - __call

Upvotes: 2

Roman Meyer
Roman Meyer

Reputation: 2872

I assume you are using this package

https://github.com/darthsoup/laravel-whmcs

It is just wrap for working with WHMCS API.

There is API reference for GetProducts

https://developers.whmcs.com/api-reference/getproducts/

So, as far I understood, you have to just set right name with camel case

Whmcs::GetProducts([
    'pid' => 1,
])

Or without magic methods:

$whmcs = app('whmcs');
$whmcs->execute('GetProducts', [
    'pid' => 1,
]);

Upvotes: 1

Related Questions