Try the following:
<?php
use Illuminate\Database\Capsule\Manager as Capsule;
function addon_hook_AdminAreaPage($vars)
{
// Retrieve the admin's ID
$adminID = $vars['adminid'];
// Query the tbladminroles table to check if the admin's ID matches the desired ID
$desiredRoleID = 5;
$isAdminInsideSales = Capsule::table('tbladmins')
->where('id', $adminID)
->where('roleid', $desiredRoleID)
->exists();
// If the admin is in the desired role, redirect to insidesales.php
if ($isAdminInsideSales) {
$redirectURL = 'insidesales.php';
header("Location: $redirectURL");
exit;
}
}
add_hook('AdminAreaPage', 1, 'addon_hook_AdminAreaPage');