Fix customer property: add ordered_customer as customer alias in queries

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-06 05:50:13 +05:00
parent 73b0041643
commit 446736202c
3 changed files with 8 additions and 8 deletions

View File

@@ -25,15 +25,15 @@ class HomeController extends Controller
$estateOrders = DB::table('estate_orders')->count();
$recentOrders = collect(
DB::table('auto_orders')->latest()->limit(5)->get()->map(fn($o) => (object)array_merge((array)$o, ['type' => 'auto_']))
DB::table('auto_orders')->selectRaw('*, ordered_customer as customer')->latest()->limit(5)->get()->map(fn($o) => (object)array_merge((array)$o, ['type' => 'auto_']))
)->merge(
DB::table('estate_orders')->latest()->limit(5)->get()->map(fn($o) => (object)array_merge((array)$o, ['type' => 'estate_']))
DB::table('estate_orders')->selectRaw('*, ordered_customer as customer')->latest()->limit(5)->get()->map(fn($o) => (object)array_merge((array)$o, ['type' => 'estate_']))
)->sortByDesc('created_at')->take(10)->values();
$forModerate = collect(
DB::table('auto_orders')->where('status', 'moderated')->latest()->limit(10)->get()->map(fn($o) => (object)array_merge((array)$o, ['type' => 'auto_']))
DB::table('auto_orders')->selectRaw('*, ordered_customer as customer')->where('status', 'moderated')->latest()->limit(10)->get()->map(fn($o) => (object)array_merge((array)$o, ['type' => 'auto_']))
)->merge(
DB::table('estate_orders')->where('status', 'moderated')->latest()->limit(10)->get()->map(fn($o) => (object)array_merge((array)$o, ['type' => 'estate_']))
DB::table('estate_orders')->selectRaw('*, ordered_customer as customer')->where('status', 'moderated')->latest()->limit(10)->get()->map(fn($o) => (object)array_merge((array)$o, ['type' => 'estate_']))
)->sortByDesc('updated_at')->take(10)->values();
$actions = DB::table('tracking_actions')->latest()->limit(20)->get();