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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user