mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-24 16:53:17 +00:00
Add AdminInstanceController
This commit is contained in:
parent
c2635fa107
commit
dd80bdcd94
1 changed files with 35 additions and 0 deletions
35
app/Http/Controllers/Admin/AdminInstanceController.php
Normal file
35
app/Http/Controllers/Admin/AdminInstanceController.php
Normal file
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use DB, Cache;
|
||||
use App\{Instance, Profile};
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
trait AdminInstanceController
|
||||
{
|
||||
|
||||
public function instances(Request $request)
|
||||
{
|
||||
$instances = Instance::orderByDesc('id')->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();
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue