@extends('layouts.app') @push('styles') @vite('resources/css/pages/admin-dashboard.css') @endpush @section('content') @include('components.admin-header') @php $totalUsers = \App\Models\User::count(); $activeUsers = \App\Models\User::where('is_admin', false)->where('is_active', true)->count(); $pendingUsers = \App\Models\User::where('is_admin', false)->where('is_active', false)->count(); $adminCount = \App\Models\User::where('is_admin', true)->count(); $totalProducts = \App\Models\Product::count(); $users = \App\Models\User::latest()->get(); // Inscriptions par mois (6 derniers mois) $months = collect(); for ($i = 5; $i >= 0; $i--) { $date = now()->subMonths($i); $count = \App\Models\User::where('is_admin', false) ->whereYear('created_at', $date->year) ->whereMonth('created_at', $date->month) ->count(); $months->push(['label' => $date->isoFormat('MMM YY'), 'count' => $count]); } // Statistiques vidéos & stockage $totalVideos = \App\Models\Product::whereNotNull('video')->where('video','!=','')->count(); $formatBytes = function(int $bytes): string { if ($bytes >= 1073741824) return round($bytes/1073741824,2).' Go'; if ($bytes >= 1048576) return round($bytes/1048576,2).' Mo'; if ($bytes >= 1024) return round($bytes/1024,1).' Ko'; return $bytes.' o'; }; $totalVideoBytes = \App\Models\Product::whereNotNull('video')->where('video','!=','')->pluck('video') ->sum(fn($p) => \Illuminate\Support\Facades\Storage::disk('public')->exists($p) ? \Illuminate\Support\Facades\Storage::disk('public')->size($p) : 0); $totalImageBytes = \App\Models\Product::whereNotNull('image')->where('image','!=','')->pluck('image') ->sum(fn($p) => \Illuminate\Support\Facades\Storage::disk('public')->exists($p) ? \Illuminate\Support\Facades\Storage::disk('public')->size($p) : 0); $totalVideoSize = $formatBytes((int)$totalVideoBytes); $totalImageSize = $formatBytes((int)$totalImageBytes); $totalImages = \App\Models\Product::whereNotNull('image')->where('image','!=','')->count(); // Top 5 utilisateurs par nombre de produits $topUsers = \App\Models\User::where('is_admin', false) ->withCount('products') ->orderByDesc('products_count') ->limit(5) ->get(); // Répartition comptes $withLogo = \App\Models\User::where('is_admin', false)->whereNotNull('logo')->where('logo','!=','')->count(); $withoutLogo = \App\Models\User::where('is_admin', false)->where(fn($q) => $q->whereNull('logo')->orWhere('logo',''))->count(); $withProducts2 = \App\Models\User::where('is_admin', false)->has('products')->count(); $noProducts = \App\Models\User::where('is_admin', false)->doesntHave('products')->count(); @endphp
{{ $totalUsers }} utilisateurs enregistrés
| {{ $th }} | @endforeach|||||
|---|---|---|---|---|---|
|
{{ strtoupper(substr($u->name, 0, 1)) }}
{{ $u->name }}
@if($u->is_admin)
Admin
@endif
|
@if($u->is_admin) Admin @elseif($u->is_active) Actif @else En attente @endif | {{ $u->phone ?? '—' }} |
|
@if($u->logo && \Storage::disk('public')->exists($u->logo))
|
@if(!$u->is_admin)
@endif
Voir page
|
| # | Lien source | URL cible | Actions |
|---|---|---|---|
| {{ $redir->id }} | {{ $redir->source }} | {{ $redir->destination }} |
|
Cliquez sur "Nouvelle redirection" pour en créer une.