mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-28 23:01:29 +00:00
Add country to user data in admin area
This commit is contained in:
@@ -10,6 +10,7 @@ use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Jrean\UserVerification\Facades\UserVerification;
|
||||
use Spatie\Permission\Models\Role;
|
||||
use Stevebauman\Location\Facades\Location;
|
||||
|
||||
class AdminUserController extends BasePageController
|
||||
{
|
||||
@@ -53,6 +54,16 @@ class AdminUserController extends BasePageController
|
||||
|
||||
$results = $this->paginate($result ?? [], User::getCount($variables['role'], $variables['username'], $variables['host'], $variables['email']) ?? 0, config('nntmux.items_per_page'), $page, $request->url(), $request->query());
|
||||
|
||||
// Add country data to each user based on their host IP
|
||||
foreach ($results as $user) {
|
||||
$position = null;
|
||||
if (!empty($user->host) && filter_var($user->host, FILTER_VALIDATE_IP)) {
|
||||
$position = Location::get($user->host);
|
||||
}
|
||||
$user->country_name = $position ? $position->countryName : null;
|
||||
$user->country_code = $position ? $position->countryCode : null;
|
||||
}
|
||||
|
||||
$this->smarty->assign(
|
||||
[
|
||||
'username' => $variables['username'],
|
||||
|
||||
@@ -104,6 +104,7 @@
|
||||
"spatie/laravel-permission": "^6.16",
|
||||
"sspat/es-query-sanitizer": "^1.0",
|
||||
"stechstudio/laravel-zipstream": "^5.4",
|
||||
"stevebauman/location": "^7.5",
|
||||
"symfony/http-client": "^7.0",
|
||||
"symfony/postmark-mailer": "^7.0",
|
||||
"symfony/process": "^7.0",
|
||||
|
||||
Generated
+70
-1
@@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "03f39cab20bcd22f2daaa24ab30d2b51",
|
||||
"content-hash": "2b382facdfd79c66e30785ffd5f8fc49",
|
||||
"packages": [
|
||||
{
|
||||
"name": "aharen/omdbapi",
|
||||
@@ -10433,6 +10433,75 @@
|
||||
},
|
||||
"time": "2025-05-14T19:04:31+00:00"
|
||||
},
|
||||
{
|
||||
"name": "stevebauman/location",
|
||||
"version": "v7.5.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/stevebauman/location.git",
|
||||
"reference": "4091806f36da22f903e3013b42629b3b9f0ef014"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/stevebauman/location/zipball/4091806f36da22f903e3013b42629b3b9f0ef014",
|
||||
"reference": "4091806f36da22f903e3013b42629b3b9f0ef014",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-curl": "*",
|
||||
"ext-json": "*",
|
||||
"geoip2/geoip2": "^2.0|^3.0",
|
||||
"guzzlehttp/guzzle": "^7.0",
|
||||
"illuminate/support": "^8.0|^9.0|^10.0|^11.0|^12.0",
|
||||
"php": ">=8.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"mockery/mockery": "^1.0",
|
||||
"orchestra/testbench": "^6.0|^7.0|^8.0|^9.0|^10.0",
|
||||
"pestphp/pest": "^1.0|^2.0|^3.7"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"aliases": {
|
||||
"Location": "Stevebauman\\Location\\Facades\\Location"
|
||||
},
|
||||
"providers": [
|
||||
"Stevebauman\\Location\\LocationServiceProvider"
|
||||
]
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Stevebauman\\Location\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Steve Bauman",
|
||||
"email": "steven_bauman@outlook.com"
|
||||
}
|
||||
],
|
||||
"description": "Retrieve a user's location by their IP Address",
|
||||
"keywords": [
|
||||
"IP",
|
||||
"geo",
|
||||
"geo-location",
|
||||
"geoip",
|
||||
"laravel",
|
||||
"location",
|
||||
"php"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/stevebauman/location/issues",
|
||||
"source": "https://github.com/stevebauman/location/tree/v7.5.0"
|
||||
},
|
||||
"time": "2025-02-19T04:59:26+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/cache",
|
||||
"version": "v7.2.6",
|
||||
|
||||
@@ -144,6 +144,12 @@
|
||||
</div>
|
||||
<small class="text-muted d-block mt-1">
|
||||
<i class="fa fa-globe me-1"></i>{$user->host}
|
||||
{if $user->country_code}
|
||||
<span class="ms-2">
|
||||
<img src="https://flagcdn.com/16x12/{$user->country_code|lower}.png" alt="{$user->country_name}" width="16" height="12" class="me-1">
|
||||
<span>{$user->country_name}</span>
|
||||
</span>
|
||||
{/if}
|
||||
</small>
|
||||
</td>
|
||||
<td>
|
||||
|
||||
Reference in New Issue
Block a user