我是廣告,點擊一下吧!
標籤
#Flutter (15) 、 #PHP (9) 、 #Laravel (7) 、 #Dart (5) 、 #MySQL (5) 、 #Mac (4) 、 #VS Code (2) 、 #IDE (2) 、 #List (2) 、 #Android (2) 、 #Carbon (2) 、 #Linux (2) 、 #Shell Script (2) 、 #MySQL 效能 (1) 、 #Pagination (1) 、 #Cursor Pagination (1) 、 #LaTeX (1) 、 #個人空間 (1) 、 #Android Splash Screen (1) 、 #createFromTimestamp (1) 、 #資安 (1) 、 #Google Maps Static API (1) 、 #Mac M1 (1) 、 #floorMonth (1) 、 #subMonthNoOverflow (1) 、 #addMonthNoOverflow (1) 、 #subMonth (1) 、 #addMonth (1) 、 #keytool (1) 、 #Play App Signing (1)User::query()
// and `col` = ?
->where('col', 'foo')
// and `col` > ?
->where('col', '>', 'foo')
// and `col` in (?, ?)
->whereIn('col', ['foo', 'bar'])
// and `col` not in (?, ?)
->whereNotIn('col', ['foo', 'bar'])
// and `col` between ? and ?
->whereBetween('col', [0, 10])
// and `col` not between ? and ?
->whereNotBetween('col', [0, 10])
// -----------------Raw-----------------
// and 1=1
->whereRaw('1=1')
// and `col` in (?, ?, ?)
->whereIntegerInRaw('col', [1, 2, 3])
// and `col` not in (?, ?, ?)
->whereIntegerNotInRaw('col', [1, 2, 3])
// -----------------Column-----------------
// and `col1` between `col2` and `col3`
->whereBetweenColumns('col1', ['col2', 'col3'])
// and `col1` not between `col2` and `col3`
->whereNotBetweenColumns('col1', ['col2', 'col3'])
// and `col1` = `col2`
->whereColumn('col1', 'col2')
// and `col1` > `col2`
->whereColumn('col1', '>', 'col2')
// -----------------Date Time-----------------
// and date(`col`) = ?
->whereDate('col', Carbon::today())
// and date(`col`) > ?
->whereDate('col', '>', Carbon::today())
// and year(`col`) = ?
->whereYear('col', 2022)
// and year(`col`) > ?
->whereYear('col', '>', 2022)
// and month(`col`) = ?
->whereMonth('col', 12)
// and month(`col`) < ?
->whereMonth('col', '<', 12)
// and day(`col`) = ?
->whereDay('col', 1)
// and day(`col`) > ?
->whereDay('col', '>', 1)
// and time(`col`) = ?
->whereTime('col', '10:59:59')
// and time(`col`) > ?
->whereTime('col', '>', '10:59:59')
// -----------------Sub Query-----------------
// and `col` = (select `id` from `user` where `id` = ?)
->where('col', function ($query) {
$query->select(['id'])->from('user')->where('id', 1);
})
// -----------------Nested-----------------
// and (`col` = ? or `col` = ?)
->where(function ($query) {
$query->where('col', 'foo');
$query->orWhere('col', 'foo');
})
// -----------------Exists-----------------
// and exists (select `id` from `user` where `id` = ?)
->whereExists(function ($query) {
$query->select(['id'])->from('user')->where('id', 3);
})
// -----------------Other-----------------
// and match (`col1`, `col2`) against (? in natural language mode)
->whereFullText(['col1', 'col2'], '123')
// and (`col1`, `col2`) = (?, ?)
->whereRowValues(['col1', 'col2'], '=', ['foo', 'bar'])
->toSql()