|
|
@ -42,18 +42,18 @@ trait AdminInstanceController
|
|
|
|
|
|
|
|
|
|
|
|
public function instanceScan(Request $request)
|
|
|
|
public function instanceScan(Request $request)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
DB::transaction(function() {
|
|
|
|
Profile::whereNotNull('domain')
|
|
|
|
Profile::select('domain')->whereNotNull('domain')
|
|
|
|
->latest()
|
|
|
|
->groupBy('id')
|
|
|
|
|
|
|
|
->groupBy('domain')
|
|
|
|
->groupBy('domain')
|
|
|
|
->chunk(50, function($domains) {
|
|
|
|
->where('created_at', '>', now()->subMonths(2))
|
|
|
|
|
|
|
|
->chunk(100, function($domains) {
|
|
|
|
foreach($domains as $domain) {
|
|
|
|
foreach($domains as $domain) {
|
|
|
|
Instance::firstOrCreate([
|
|
|
|
Instance::firstOrCreate([
|
|
|
|
'domain' => $domain->domain
|
|
|
|
'domain' => $domain->domain
|
|
|
|
]);
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
return redirect()->back();
|
|
|
|
return redirect()->back();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|