belongsTo(Location::class); } /** * @throws Exception */ public static function syncNodes(){ Location::syncLocations(); $nodes = Pterodactyl::getNodes(); $nodes = array_map(function($node) { return array( 'id' => $node['attributes']['id'], 'location_id' => $node['attributes']['location_id'], 'name' => $node['attributes']['name'], 'description' => $node['attributes']['description'], 'disabled' => '1' ); }, $nodes); foreach ($nodes as $node) { self::firstOrCreate(['id' => $node['id']] , $node); } } }