WHMCS / sample-addon-module

Sample Addon Module for WHMCS
MIT License
68 stars 74 forks source link

Missing files #1

Closed jozephbrasil closed 7 years ago

jozephbrasil commented 7 years ago

Where is the Addon Sample? I am looking for it.

How to get module_config options in the hooks.php file inside addon folder?

mattpugh commented 7 years ago

Hi Jozeph,

Hooks do not have a built in method for retrieving the configuration parameters of an addon module. If you are needing the configuration parameters from the database within your hook function, you would need to fetch them at the point they are needed. You could do that using Capsule like this:

use WHMCS\Database\Capsule;

$value = Capsule::table('tbladdonmodules')
    ->where('module', '=', 'modulename')
    ->where('setting', '=', 'Setting Name')
    ->pluck('value');

Hope this helps.

P.S. Access to the sample files should be fixed now.

Matt

jozephbrasil commented 7 years ago

Great! Thank you for publish sample and given example code above.

mattpugh commented 7 years ago

No worries, if you need anything else, just let us know!