laravel-cross-eloquent-search icon indicating copy to clipboard operation
laravel-cross-eloquent-search copied to clipboard

Want to achieve with customer orders count and select specific columns for customers table

Open AtiqurCode opened this issue 1 year ago • 0 comments

        Search::add(Customer::withCount('orders')->select('id', 'first_name', 'last_name', 'email', 'orders_count'), ['first_name', 'last_name'], 'first_name')
            ->add(Order::orderListSelectColumns(), ['order_number'], 'order_date')
            ->endWithWildcard()
            ->includeModelType()
            ->orderByDesc()
            ->paginate(25)
            ->search($searchValue);

Want to achieve with customer order count and select specific columns for customers' table?

But the count not coming orders_count not found error returning

Column not found: 1054 Unknown column 'orders_count' in 'field list'

AtiqurCode avatar Dec 02 '24 09:12 AtiqurCode