Initial commit: WitShop Laravel Online-Shop
- Laravel 11, Blade, Alpine.js, Tailwind CSS - Produkt- & Kategorieverwaltung mit Varianten - Checkout (Vorkasse + Rechnung), Session-Warenkorb - Admin-Backend (Dashboard, Bestellungen, Kunden, CMS) - DSGVO-konform: Cookie-Consent, Impressum, Widerruf, AGB - PDF-Rechnung via dompdf, SMTP-Mailversand - Kundenverwaltung mit manueller Freischaltung Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Order;
|
||||
use App\Models\Product;
|
||||
use App\Models\ProductVariant;
|
||||
|
||||
class DashboardController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$todayRevenue = Order::whereDate('created_at', today())->whereIn('status', ['payment_received','processing','shipped','completed'])->sum('total');
|
||||
$monthRevenue = Order::whereMonth('created_at', now()->month)->whereYear('created_at', now()->year)->whereIn('status', ['payment_received','processing','shipped','completed'])->sum('total');
|
||||
$openOrders = Order::where('status', 'new')->count();
|
||||
$lowStock = ProductVariant::whereColumn('stock', '<=', 'stock_warning')->where('active', true)->with('product')->get();
|
||||
$recentOrders = Order::with('addresses')->latest()->take(10)->get();
|
||||
|
||||
return view('admin.dashboard.index', compact('todayRevenue', 'monthRevenue', 'openOrders', 'lowStock', 'recentOrders'));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user