You can't overwrite the preliminary join of a belongstomany relationship, so the solution is to add a new model that you can relate to both and run through it.
Log::info('/////////////////// SERVER USER SYNC ///////////////////');
$i=1;
$server = Server::first();
foreach ($server->vpnhub->groups as $group) {
foreach ($group->users as $user) {
Log::info('SERVICEPLAN USER LIST: '.$i++.':'.
' ID: '.$user->id.
' USER: '.$user->username.
' PLAN: '.$user->vpnuser->plan->name
);
}
}
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community