⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.23
Server IP:
178.33.27.10
Server:
Linux cpanel.dev-unit.com 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64
Server Software:
Apache/2.4.57 (Unix) OpenSSL/1.0.2k-fips
PHP Version:
8.2.11
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
home
/
id
/
public_html
/
app
/
Http
/
Controllers
/
Admin
/
View File Name :
SubdomainController.php
<?php namespace App\Http\Controllers\Admin; use App\Http\Controllers\Controller; use App\Models\User; use Carbon\Carbon; use Illuminate\Http\Request; class SubdomainController extends Controller { public function index(Request $request) { $users = User::all(); $userIds = []; foreach ($users as $key => $user) { if (cPackageHasSubdomain($user)) { $userIds[] = $user->id; } } $type = $request->type; $username = $request->username; $subdomains = User::whereHas('memberships', function($q){ $q->where('status','=',1) ->where('start_date','<=', Carbon::now()->format('Y-m-d')) ->where('expire_date', '>=', Carbon::now()->format('Y-m-d')); })->when($type, function ($query, $type) { if ($type == 'pending') { return $query->where('subdomain_status', 0); } elseif ($type == 'connected') { return $query->where('subdomain_status', 1); } })->when($username, function ($query, $username) { return $query->where('username', 'LIKE', '%' . $username . '%'); })->when(!empty($userIds), function ($query) use ($userIds) { return $query->whereIn('id', $userIds); })->paginate(10); $data['subdomains'] = $subdomains; return view('admin.subdomains.index', $data); } public function status(Request $request) { $user = User::findOrFail($request->user_id); $user->subdomain_status = $request->status; $user->save(); $request->session()->flash('success', __('Updated successfully')); return back(); } }