getBody()); $validapps = []; foreach($list->apps as $app) { $validapps[] = $app->appid; if(!file_exists(app_path('SupportedApps/'.className($app->name)))) { SupportedApps::getFiles($app); $application = new Application; SupportedApps::saveApp($app, $application); } else { // check if there has been an update for this app $localapp = $localapps->where('appid', $app->appid)->first(); if($localapp) { if($localapp->sha !== $app->sha) { SupportedApps::getFiles($app); SupportedApps::saveApp($app, $localapp); } } else { SupportedApps::getFiles($app); $application = new Application; SupportedApps::saveApp($app, $application); } } } //$delete = Application::whereNotIn('appid', $validapps)->delete(); // delete any apps not in list // removed the delete so local apps can be added } }