Created
October 21, 2021 07:55
-
-
Save barryo/314798784c0956d6f8c8ae5a0ab1a1f3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use IXP\Models\Customer; | |
// sample customer with ID 18: | |
$cust = Customer::find(18); | |
// iterate over the customer's contacts: | |
foreach( $cust->contacts as $c ) { | |
// and iterate over each contact's groups | |
foreach( $c->contactGroupsAll()->get() as $g ) { | |
echo "{$c->id} - {$g->id} - {$g->name} - {$g->type} - {$g->active}\n"; | |
} | |
} | |
// if you want just contact roles, use: | |
// $c->contactRoles()->get() | |
// if you want just contact groups excluding roles, use: | |
// $c->contactGroups()->get() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment