From dd80bdcd94a4c5ed6c05e764ada66d989571c236 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sun, 20 Jan 2019 16:26:03 -0700 Subject: [PATCH] Add AdminInstanceController --- .../Admin/AdminInstanceController.php | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 app/Http/Controllers/Admin/AdminInstanceController.php diff --git a/app/Http/Controllers/Admin/AdminInstanceController.php b/app/Http/Controllers/Admin/AdminInstanceController.php new file mode 100644 index 00000000..55600fdf --- /dev/null +++ b/app/Http/Controllers/Admin/AdminInstanceController.php @@ -0,0 +1,35 @@ +paginate(5); + return view('admin.instances.home', compact('instances')); + } + + public function instanceScan(Request $request) + { + DB::transaction(function() { + Profile::whereNotNull('domain') + ->groupBy('domain') + ->chunk(50, function($domains) { + foreach($domains as $domain) { + Instance::firstOrCreate([ + 'domain' => $domain->domain + ]); + } + }); + }); + return redirect()->back(); + } + +} \ No newline at end of file