CopyPastor

Detecting plagiarism made easy.

Score: 0.805406391620636; Reported for: String similarity Open both answers

Possible Plagiarism

Plagiarized on 2021-11-29
by AHMAD AL MSALAM

Original Post

Original - Posted on 2021-11-27
by Kylian



            
Present in both answers; Present only in the new answer; Present only in the old answer;

your query could look like that :
$bookings = Booking::where('status', '!==', Booking::STATUS_CANCELED) ->where(function ($q) use ($start, $end) { $q->where('started_at', '<=', $end) ->orWhere('started_at', '>=', $start); }) ->orWhere(function ($q) use ($start, $end) { $q->where('ends_at', '>=', $start) ->where('ends_at', '<=', $end); })->orWhere(function ($q) use ($start, $end) { $q->where('started_at', '<', $start) ->where('ends_at', '>', $end); })->get();
I think I found a solution :
$bookings = DB::table('bookings') ->where(function ($q) use ($start, $end) { $q->where('started_at', '>=', $start) ->where('started_at', '<=', $end); }) ->orWhere(function ($q) use ($start, $end) { $q->where('ends_at', '>=', $start) ->where('ends_at', '<=', $end); }) ->orWhere(function ($q) use ($start, $end) { $q->where('started_at', '<', $start) ->where('ends_at', '>', $end); }) ->count();

        
Present in both answers; Present only in the new answer; Present only in the old answer;