Laravel 中的预订时段,带设备库存查询

这是一个对大家来说很有趣的事情。我发现自己陷入了实施难题。


我正在 Laravel 中开发一个预订应用程序,允许人们在特定时间预订空间的房间和设备。可用设备的数量有限,因此必须根据与预订相关的时段来查询库存量。


我以为我已经通过迭代同时发生的“其他预订”并计算当前正在使用的物品来解决问题 -> 然后对照库存中的可用物品进行检查。


对于我 90% 的测试来说,这工作得很好,但我刚刚发现了一个不允许我这样做的错误。


    $guitarheadcount = 0;

    $guitarcabcount = 0;

    $guitarcombocount = 0;

    $bassheadcount = 0;

    $basscabcount = 0;

    $basscombocount = 0;

    $drumkitcount = 0;

    $cymbalscount = 0;


    $otherbookings = Booking::where('Room_id', '!=', $bookinginfo->Room_id)

        ->where(function ($query) use ($begin, $end) {

            $query->where(function ($q) use ($begin, $end) {

                $q->where('Booking_start', '>=', $begin)

                ->where('Booking_start', '<', $end);

            })->orWhere(function ($q) use ($begin, $end) {

                $q->where('Booking_start', '<=', $begin)

                ->where('Booking_end', '>', $end);

            })->orWhere(function ($q) use ($begin, $end) {

                $q->where('Booking_end', '>', $begin)

                ->where('Booking_end', '<=', $end);

            })->orWhere(function ($q) use ($begin, $end) {

                $q->where('Booking_start', '>=', $begin)

                ->where('Booking_end', '<=', $end);

            });

    })->get();


    }

然后,如果计数最终大于库存量,我使用单独的 if 语句来重定向。


实际错误的一个示例是:


2 套鼓有库存。预订一个下午 1-2 点的房间……然后在同一房间预订另一个下午 2-3 点的房间。两者都需要鼓组。


如果我随后尝试在下午 1 点到 3 点之间在不同的空间进行预订,即使一组鼓再次空闲(如果这有意义),计数也已经是 2。


我真的很困惑。我无法想象我是否需要:


继续“计数”,但生成一些东西,为与另一个(?)位于同一房间的每件物品扣除 1。

我是否应该完全放弃计数并为每个设备项目编写单独的查询......以及我什至会如何做到这一点!

任何帮助将非常感激。


富国沪深
浏览 77回答 2
2回答

达令说

尽管我之前的答案中的方法看起来很有希望......但随着库存量和相邻预订的增加,它开始出现无法修复的计数错误。我重新思考并设计了更好的解决方案。无论如何,用户只能预订至少 30 分钟的时段。因此,使用 do/while 循环,对于用户选择的时间段每增加 30 分钟,它将执行一次库存检查。我确信敲打服务器并不是一件好事,但至少在预订期间会有固定的时间来查询它。///STOCK CHECK&nbsp; &nbsp; $stockcheckbegin = $begin;&nbsp; &nbsp; $stockcheckend = date("Y-m-d H:i", strtotime('+30 minutes',strtotime($begin)));&nbsp; &nbsp; $tempguitarheadcount = 0;&nbsp; &nbsp; $tempguitarcabcount = 0;&nbsp; &nbsp; $tempguitarcombocount = 0;&nbsp; &nbsp; $tempbassheadcount = 0;&nbsp; &nbsp; $tempbasscabcount = 0;&nbsp; &nbsp; $tempbasscombocount = 0;&nbsp; &nbsp; $tempdrumkitcount = 0;&nbsp; &nbsp; $tempcymbalscount = 0;&nbsp; &nbsp; do {&nbsp; &nbsp; &nbsp; &nbsp; $otherbookings = Booking::orderby('Booking_start', 'ASC')&nbsp; &nbsp; &nbsp; &nbsp; ->where(function ($query) use ($stockcheckbegin, $stockcheckend) {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $query->where(function ($q) use ($stockcheckbegin, $stockcheckend) {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $q->where('Booking_start', '>=', $stockcheckbegin)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ->where('Booking_start', '<', $stockcheckend);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; })->orWhere(function ($q) use ($stockcheckbegin, $stockcheckend) {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $q->where('Booking_start', '<=', $stockcheckbegin)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ->where('Booking_end', '>', $stockcheckend);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; })->orWhere(function ($q) use ($stockcheckbegin, $stockcheckend) {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $q->where('Booking_end', '>', $stockcheckbegin)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ->where('Booking_end', '<=', $stockcheckend);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; })->orWhere(function ($q) use ($stockcheckbegin, $stockcheckend) {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $q->where('Booking_start', '>=', $stockcheckbegin)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ->where('Booking_end', '<=', $stockcheckend);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; });&nbsp; &nbsp; &nbsp; &nbsp; })->get();&nbsp; &nbsp; &nbsp; &nbsp; foreach($otherbookings as $other){&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $tempguitarheadcount = $tempguitarheadcount + $other->Equip->guitarheadamount;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $tempguitarcabcount = $tempguitarcabcount + $other->Equip->guitarcabamount;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $tempguitarcombocount = $tempguitarcombocount + $other->Equip->guitarcomboamount;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $tempbassheadcount = $tempbassheadcount + $other->Equip->bassheadamount;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $tempbasscabcount = $tempbasscabcount + $other->Equip->basscabamount;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $tempbasscombocount = $tempbasscombocount + $other->Equip->basscomboamount;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $tempdrumkitcount = $tempdrumkitcount + $other->Equip->drumkitamount;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $tempcymbalscount = $tempcymbalscount + $other->Equip->cymbalsamount;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(($currenthireprices->guitarheadstock - ($guitarheadamount + $tempguitarheadcount)) < 0){&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return redirect()->back()->withInput()->with('Booking_query_error', "Sorry! Our 'Guitar Head' stock will run out during the course of this booking. (Between $stockcheckbegin and $stockcheckend)");&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(($currenthireprices->guitarcabstock - ($guitarcabamount + $tempguitarcabcount)) < 0){&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return redirect()->back()->withInput()->with('Booking_query_error', "Sorry! Our 'Guitar Cab' stock will run out during the course of this booking. (Between $stockcheckbegin and $stockcheckend)");&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(($currenthireprices->guitarcombostock - ($guitarcomboamount + $tempguitarcombocount)) < 0){&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return redirect()->back()->withInput()->with('Booking_query_error', "Sorry! Our 'Guitar Combo' stock will run out during the course of this booking. (Between $stockcheckbegin and $stockcheckend)");&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(($currenthireprices->bassheadstock - ($bassheadamount + $tempbassheadcount)) < 0){&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return redirect()->back()->withInput()->with('Booking_query_error', "Sorry! Our 'Bass Head' stock will run out during the course of this booking. (Between $stockcheckbegin and $stockcheckend)");&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(($currenthireprices->basscabstock - ($basscabamount + $tempbasscabcount)) < 0){&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return redirect()->back()->withInput()->with('Booking_query_error', "Sorry! Our 'Bass Cab' stock will run out during the course of this booking. (Between $stockcheckbegin and $stockcheckend)");&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(($currenthireprices->basscombostock - ($basscomboamount + $tempbasscombocount)) < 0){&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return redirect()->back()->withInput()->with('Booking_query_error', "Sorry! Our 'Bass Combo' stock will run out during the course of this booking. (Between $stockcheckbegin and $stockcheckend)");&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(($currenthireprices->drumkitstock - ($drumkitamount + $tempdrumkitcount)) < 0){&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return redirect()->back()->withInput()->with('Booking_query_error', "Sorry! Our 'Drum kit' stock will run out during the course of this booking. (Between $stockcheckbegin and $stockcheckend)");&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(($currenthireprices->cymbalsstock - ($cymbalsamount + $tempcymbalscount)) < 0){&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return redirect()->back()->withInput()->with('Booking_query_error', "Sorry! Our sets of 'Cymbals' stock will run out during the course of this booking. (Between $stockcheckbegin and $stockcheckend)");&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $tempguitarheadcount = 0;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $tempguitarcabcount = 0;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $tempguitarcombocount = 0;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $tempbassheadcount = 0;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $tempbasscabcount = 0;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $tempbasscombocount = 0;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $tempdrumkitcount = 0;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $tempcymbalscount = 0;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $stockcheckbegin = date("Y-m-d H:i", strtotime('+30 minutes',strtotime($stockcheckbegin)));&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $stockcheckend = date("Y-m-d H:i", strtotime('+30 minutes',strtotime($stockcheckend)));&nbsp; &nbsp; } while ($stockcheckbegin != $end);&nbsp; &nbsp; if(($currenthireprices->guitarheadstock - ($guitarheadamount + $guitarheadcount)) < 0){&nbsp; &nbsp; &nbsp; &nbsp; return redirect()->back()->withInput()->with('Booking_query_error', "Unfortunatly there aren't $guitarheadamount guitar heads available between $timestart and $timeend. There's $currenthireprices->guitarheadstock in stock and $guitarheadcount in use.");&nbsp; &nbsp; }&nbsp; &nbsp; if(($currenthireprices->guitarcabstock - ($guitarcabamount + $guitarcabcount)) < 0){&nbsp; &nbsp; &nbsp; &nbsp; return redirect()->back()->withInput()->with('Booking_query_error', "Unfortunatly there aren't $guitarcabamount 'Guitar cabs' available between $timestart and $timeend. There's $currenthireprices->guitarcabstock in stock and $guitarcabcount in use.");&nbsp; &nbsp; }&nbsp; &nbsp; if(($currenthireprices->guitarcombostock - ($guitarcomboamount + $guitarcombocount)) < 0){&nbsp; &nbsp; &nbsp; &nbsp; return redirect()->back()->withInput()->with('Booking_query_error', "Unfortunatly there aren't $guitarcomboamount 'Guitar combos' available between $timestart and $timeend. There's $currenthireprices->guitarcombostock in stock and $guitarcombocount in use.");&nbsp; &nbsp; }&nbsp; &nbsp; if(($currenthireprices->bassheadstock - ($bassheadamount + $bassheadcount)) < 0) {&nbsp; &nbsp; &nbsp; &nbsp; return redirect()->back()->withInput()->with('Booking_query_error', "Unfortunatly there aren't $bassheadamount 'Bass heads' available between $timestart and $timeend. There's $currenthireprices->bassheadstock in stock and $bassheadcount in use.");&nbsp; &nbsp; }&nbsp; &nbsp; if(($currenthireprices->basscabstock - ($basscabamount + $basscabcount)) < 0) {&nbsp; &nbsp; &nbsp; &nbsp; return redirect()->back()->withInput()->with('Booking_query_error', "Unfortunatly there aren't $basscabamount 'Bass cabs' available between $timestart and $timeend. There's $currenthireprices->basscabstock in stock and $basscabcount in use.");&nbsp; &nbsp; }&nbsp; &nbsp; if(($currenthireprices->basscombostock - ($basscomboamount + $basscombocount)) < 0){&nbsp; &nbsp; &nbsp; &nbsp; return redirect()->back()->withInput()->with('Booking_query_error', "Unfortunatly there aren't $basscomboamount 'Bass combos' available between $timestart and $timeend. There's $currenthireprices->basscombostock in stock and $basscombocount in use.");&nbsp; &nbsp; }&nbsp; &nbsp; if(($currenthireprices->drumkitstock - ($drumkitamount + $drumkitcount)) < 0){&nbsp; &nbsp; &nbsp; &nbsp; return redirect()->back()->withInput()->with('Booking_query_error', "Unfortunatly there aren't $drumkitamount 'Drum kits' available between $timestart and $timeend. There's $currenthireprices->drumkitstock in stock and $drumkitcount in use.");&nbsp; &nbsp; }&nbsp; &nbsp; if(($currenthireprices->cymbalsstock - ($cymbalsamount + $cymbalscount)) < 0){&nbsp; &nbsp; &nbsp; &nbsp; return redirect()->back()->withInput()->with('Booking_query_error', "Unfortunatly there aren't $cymbalsamount 'sets of cymbals' available between $timestart and $timeend. There's $currenthireprices->cymbalsstock in stock and $cymbalscount in use.");&nbsp; &nbsp; }&nbsp; &nbsp; //----- END OF STOCK CHECK

慕娘9325324

我将进一步测试这一点,但我想我可能已经找到了解决方案。我已经拥有的:一种在选定时间范围内获取所有冲突预订的机制。它可以提供集合中包含的所有项目的计数。它不“知道”的是在预订过程中,库存是否会被用完。解决方案(到目前为止,早期测试正在发挥作用)。我使用 orderBy 按开始时间对原始查询结果进行排序。我使用 foreach 来循环遍历它们。我在循环之外定义了几个数组,可以使用它们将先前循环的属性传递回下一个循环。如果没有发现计数错误,则在最后覆盖。然后我创建了一些 if 语句来检查下一个预订与上一个预订。如果下一个开始是在上一个结束之前,那么我会创建另一个数组来将当前值传递到其中,并在 if 内为每个数组启动另一个数组,然后重新计算该时间范围内的所有预订。如果计数再次超过该时间内的可用库存,它就会爆发并重定向。当该循环完成后,我们继续前一个循环。对意大利面条代码表示歉意。$first = $otherbookings->first();&nbsp; &nbsp; if ($first == null){&nbsp; &nbsp; }else{&nbsp; &nbsp; &nbsp; &nbsp;$previous = [];&nbsp; &nbsp; $previous ['id'] = $first->id;&nbsp; &nbsp; $previous ['Booking_end'] = $first->Booking_end;&nbsp; &nbsp; }&nbsp; &nbsp; $tempdrumkitcount = 0;&nbsp; &nbsp; foreach($otherbookings as $other){&nbsp; &nbsp; &nbsp; &nbsp; if($previous ['id'] == $other->id){&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $drumkitcount = (int)$first->Equip->drumkitamount;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //check&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(($currenthireprices->drumkitstock - ($other->drumkitamount + $drumkitcount)) < 0){&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return redirect()->back()->withInput()->with('Booking_query_error', "Check 1 error");&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; else{&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if($previous ['Booking_end'] > $other->Booking_start){&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $current ['id'] = $other->id;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $current ['Booking_start'] = $other->Booking_start;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $current ['Booking_end'] = $other->Booking_end;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; foreach($otherbookings as $newother){&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if($newother->id != $current ['id']){&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(($newother->Booking_start < $current ['Booking_start']) && ($newother->Booking_end > $current ['Booking_start'] )){&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $tempdrumkitcount = $tempdrumkitcount + $newother->Equip->drumkitamount;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(($newother->Booking_start > $current ['Booking_start']) && ($newother->Booking_end < $current ['Booking_end'] )){&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $tempdrumkitcount = $tempdrumkitcount + $newother->Equip->drumkitamount;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(($currenthireprices->drumkitstock - ($drumkitamount + $tempdrumkitcount)) < 0){&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return redirect()->back()->withInput()->with('Booking_query_error', "Unfortunatly there aren't $drumkitamount 'Drum kits' available between $timestart and $timeend to complete your booking. (Error- 100 [Cummalative Check]).");&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $drumkitcount = $other->Equip->drumkitamount + $drumkitcount;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(($currenthireprices->drumkitstock - ($drumkitamount + $drumkitcount)) < 0){&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return redirect()->back()->withInput()->with('Booking_query_error', "Unfortunatly there aren't $drumkitamount 'Drum kits' available between $timestart and $timeend to complete your booking. (Error- 150 [Non-Cummalative Check]).");&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $drumkitcount =&nbsp; $drumkitcount - $previous ['drumkitamount'];&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if($previous ['Booking_end'] <= $other->Booking_start){&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $drumkitcount =&nbsp; $drumkitcount - $previous ['drumkitamount'];&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $drumkitcount = $drumkitcount + $other->Equip->drumkitamount;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(($currenthireprices->drumkitstock - ($drumkitamount + $drumkitcount)) < 0){&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return redirect()->back()->withInput()->with('Booking_query_error', "Unfortunatly there aren't $drumkitamount 'Drum kits' available between $timestart and $timeend to complete your booking. (Error- 200 [Non-overlap main check]).");&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; $previous ['id'] = $other->id;&nbsp; &nbsp; &nbsp; &nbsp; $previous ['Booking_end'] = $other->Booking_end;&nbsp; &nbsp; &nbsp; &nbsp; $previous ['drumkitamount'] = $other->Equip->drumkitamount;&nbsp; &nbsp; }
打开App,查看更多内容
随时随地看视频慕课网APP