
TableSelect::where를 사용하여 여러 조건을 추가하는 방법은 다음과 같습니다.
1. where 메서드를 여러 번 호출하여 조건을 추가할 수 있습니다.
#hostingforum.kr
php
$users = TableSelect::where('age', '>', 18)
->where('gender', 'woman')
->get();
2. where 메서드에 여러 조건을 하나의 문자열로 전달할 수 있습니다.
#hostingforum.kr
php
$users = TableSelect::where('age', '>', 18, 'AND', 'gender', 'woman')
->get();
3. where 메서드에 조건을 여러 개 전달할 수 있습니다.
#hostingforum.kr
php
$users = TableSelect::where([
['age', '>', 18],
['gender', 'woman']
])
->get();
4. where 메서드에 조건을 여러 개 전달할 수 있으며, 조건을 AND 또는 OR로 연결할 수 있습니다.
#hostingforum.kr
php
$users = TableSelect::where([
['age', '>', 18],
['OR', ['gender', 'woman'], ['country', 'Korea']]
])
->get();
5. where 메서드에 조건을 여러 개 전달할 수 있으며, 조건을 AND 또는 OR로 연결할 수 있습니다.
#hostingforum.kr
php
$users = TableSelect::where([
['age', '>', 18],
['AND', ['gender', 'woman'], ['country', 'Korea']]
])
->get();
2025-08-07 08:49