我想找到数组中存在的值

问题描述 投票:0回答:1

我有2个查询,我想知道第一个查询(dateincal)中存在的第二个查询的元素(date_debut)。第二个查询的元素可以在第一个查询中出现一次或多次。一旦找到日期(首次亮相)(dateincal),我希望能够再检索找到的元素的其他信息

        $feries = Jourferie::Select('dateincal', 'description')
                    ->where('dateincal', '>=', Carbon::now()->startOfMonth())
                    ->where('dateincal', '<=', Carbon::now()->endOfMonth())
                    ->get();

    $plannings = Planning::Select('date_debut', 'id', 'agent_id', 'site_id')
                 ->where('id', '!=', 0)
                 ->where('statut', 'provisoire')
                 ->get();
laravel eloquent laravel-query-builder
1个回答
0
投票
foreach($feries as $ferie){ $myresult = $plannings->contains('date_debut',$ferie->dateincal) /* do things */ }
© www.soinside.com 2019 - 2024. All rights reserved.