Skip to main content
Glama
DashboardController.php1.78 kB
<?php namespace App\Http\Controllers; use App\Models\Order; use App\Models\Product; use Illuminate\Http\Request; class DashboardController extends Controller { public function index(Request $request) { // Build orders query with search filters $ordersQuery = Order::with('product'); // Search by customer name if ($request->filled('customer_name')) { $ordersQuery->where('name', 'like', '%' . $request->customer_name . '%'); } // Search by status if ($request->filled('status')) { $ordersQuery->where('status', $request->status); } // Search by product name if ($request->filled('product_name')) { $ordersQuery->whereHas('product', function ($query) use ($request) { $query->where('name', 'like', '%' . $request->product_name . '%'); }); } // Search by date range if ($request->filled('date_from')) { $ordersQuery->whereDate('created_at', '>=', $request->date_from); } if ($request->filled('date_to')) { $ordersQuery->whereDate('created_at', '<=', $request->date_to); } // Get orders with pagination (preserve search parameters) $orders = $ordersQuery->orderBy('created_at', 'desc') ->paginate(20) ->withQueryString(); // Get all products for dropdown $products = Product::all(); // Get distinct statuses for dropdown $statuses = Order::distinct()->pluck('status')->filter(); // Get N8N webhook URL from environment $n8nWebhookUrl = env('N8N_WEBHOOK_URL'); return view('dashboard', compact('orders', 'products', 'statuses', 'n8nWebhookUrl')); } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/uberr2000/mcp_demo'

If you have feedback or need assistance with the MCP directory API, please join our Discord server