다른 구독 유형을 가진 사람들이 아닌 특정 구독을 사용하는 모든 사람을 얻으려는 구문 분석 문제가 있습니다. 구독은 구독 열의 구독 테이블에 쉼표로 구분 된 목록에 저장됩니다. 지금까지 가지고있는 코드는 다음과 같습니다.여러 개의 Eloquent Where 매개 변수가 여러 개의 매개 변수가있는 경우
$includeQuery = [];
foreach ($includeSegment as $include) {
$singleQuery = ['subscriptions','like', '%'.$include.'%', 'or'];
array_push($includeQuery, $singleQuery);
}
$excludeQuery = [];
foreach ($excludeSegment as $exclude) {
$singleQuery = ['subscriptions', 'not like', '%'.$exclude.'%', 'or'];
array_push($excludeQuery, $singleQuery);
}
$included = Subscription::where($excludeQuery)->where($includeQuery)->get();
결과가 돌아 왔지만 일부는 제외 된 구독이 있습니다.
where 절 내에 쿼리 함수를 사용하면 도움이됩니까? –