I tried the below code, but unfortunately, it doesn't work. Can you please point out what's wrong:
Thank you in advance!
@brian!
<?php
use WHMCS\View\Menu\Item;
use Illuminate\Database\Capsule\Manager as Capsule;
function hook_clientemails($vars)
{
$client = Menu::context('client');
$output = "";
$emails = Capsule::table('tblemails')
->where('userid', $client->id)
->get();
foreach ($emails as $email) {
$output .= '<tr onclick="popupWindow('viewemail.php?id={$email.id}', 'emailWin', '650', '450')">
<td class="text-center"><span class="hidden">{$email.normalisedDate}</span>{$email.date}</td>
<td>{$email.subject}</td>
<td class="text-center"><input type="button" class="btn btn-primary btn-sm" value="View" onclick="popupWindow('viewemail.php?id={$email.id}', 'emailWin', '650', '450')" /></td>
</tr>';
}
return array("clientemails" => $output);
}
add_hook("ClientAreaHomepagePanels", 1, "hook_clientemails")
{
$homePagePanels->addChild('clientemails', array(
'label' => 'Email History',
'icon' => 'fa-envelope',
'order' => 20,
'extras' => array(
'color' => 'gold',
'btn-link' => '/cart/clientarea.php?action=emails',
'btn-text' => 'View All',
'btn-icon' => 'fa-arrow-right',
),
'bodyHtml' => $output,
));
}
?>