像laravel mongodb包中的多个不起作用

I have a project which is creating in laravel and mongodb. I am using a package for connecting to mongodb "https://github.com/jenssegers/laravel-mongodb". I have a table listing. In this table listing there is a text box for search data. For that I used like feature. I have followed the same in documentation but not working. When I search invoice_number data is getting empty. But when I search beds data is getting perfectly. Please correct me.

$bookings = Booking::select('invoice_number', 'temp_user_id', 'user', 'checkin_from', 'reserve_to', 'beds', 'dormitory', 'sleeps', 'status', 'payment_status', 'payment_type', 'total_prepayment_amount', 'txid')
                ->where('is_delete', 0)
                ->where('invoice_number', 'like', "%{$search}%")
                ->orWhere('beds', 'like', "%{$search}%")
                ->skip($start)
                ->take($limit)
                ->orderBy($order, $dir)
                ->get();

The WHERE statements in your query translate to this:

WHERE [cond_1] AND [cond_2] OR [cond_3]

I doubt this is the condition you need. I'd say you want this:

WHERE [cond_1] AND ([cond_2] OR [cond_3]) -- notice the brackets.

To achieve this, you need a closure in your Builder query. Try this:

$bookings = Booking::select('invoice_number', 'temp_user_id', 'user', 'checkin_from', 'reserve_to', 'beds', 'dormitory', 'sleeps', 'status', 'payment_status', 'payment_type', 'total_prepayment_amount', 'txid')
        ->where('is_delete', 0)
        ->where(function($query) use ($search) { /* That's the closure */
            $query->where('invoice_number', 'like', "%{$search}%")
            ->orWhere('beds', 'like', "%{$search}%");
         })
        ->skip($start)
        ->take($limit)
        ->orderBy($order, $dir)
        ->get();

And an example from the docs.