Untitled
unknown
plain_text
a year ago
2.3 kB
5
Indexable
namespace App\Http\Controllers; use Illuminate\Http\Request; use App\Models\Product; use App\Models\Order; use App\Models\User; class AdminController extends Controller { public function dashboard() { $totalProducts = Product::count(); $totalOrders = Order::count(); $totalUsers = User::count(); // You can add more data fetching logic here as needed return view('admin.dashboard', compact('totalProducts', 'totalOrders', 'totalUsers')); } } @extends('layouts.admin') @section('content') <div class="container"> <h1>Admin Dashboard</h1> <div class="metrics"> <div class="metric"> <div class="value">{{ $totalProducts }}</div> <div class="label">Total Products</div> </div> <div class="metric"> <div class="value">{{ $totalOrders }}</div> <div class="label">Total Orders</div> </div> <div class="metric"> <div class="value">{{ $totalUsers }}</div> <div class="label">Total Users</div> </div> </div> <!-- Add more dashboard components and tools here --> </div> @endsection <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Admin Dashboard</title> <link rel="stylesheet" href="{{ asset('css/admin.css') }}"> </head> <body> <header> <!-- Add header content here --> </header> <nav> <!-- Add navigation menu here --> </nav> <main> @yield('content') </main> <footer> <!-- Add footer content here --> </footer> </body> </html> /* admin.css */ .container { max-width: 1200px; margin: 0 auto; padding: 20px; } .metrics { display: flex; justify-content: space-between; margin-bottom: 20px; } .metric { flex: 1; border: 1px solid #ccc; padding: 20px; text-align: center; } .metric .value { font-size: 24px; font-weight: bold; } .metric .label { margin-top: 10px; color: #666; }
Editor is loading...
Leave a Comment