PHPackages                             chastephp/laravel-wheres - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. chastephp/laravel-wheres

ActiveLibrary

chastephp/laravel-wheres
========================

A laravel wheres. Inspired by medoo

3.0.0(4y ago)157MITPHPPHP ^7.1.3|^8.0

Since Jan 6Pushed 3y ago1 watchersCompare

[ Source](https://github.com/chastephp/laravel-wheres)[ Packagist](https://packagist.org/packages/chastephp/laravel-wheres)[ RSS](/packages/chastephp-laravel-wheres/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (5)Dependencies (3)Versions (9)Used By (0)

laravel-wheres
==============

[](#laravel-wheres)

A laravel wheres. Inspired by medoo

Requirements
------------

[](#requirements)

- laravel &gt;=5.5

Installation
------------

[](#installation)

```
composer require chastephp/laravel-wheres
```

Usage
-----

[](#usage)

The SQL in the comments is based on MySQL

```
User::query()->wheres([
    "email" => "foo@bar.com"
])->toSql();
// select * from `users` where `email` = ?

User::query()->wheres([
    "user_id[>]" => 200
])->toSql();
// select * from `users` where `user_id` > ?

User::query()->wheres([
    "user_id[>=]" => 200
])->toSql();
// select * from `users` where `user_id` >= ?

User::query()->wheres([
    "user_id[!]" => 200,
])->toSql();
// select * from `users` where `user_id` != ?

User::query()->wheres([
    "age[]" => [20, 50]
])->toSql();
// select * from `users` where `age` between ? and ?

User::query()->wheres([
    "birthday[]" => [date("Y-m-d", strtotime('-30 days')), date("Y-m-d")]
])->toSql();
// select * from `users` where `birthday` between ? and ?

User::query()->wheres([
    "birthday[>
