Aggregated Methods
Learn about DataStore's aggregated methods
Original data
| name | age | income |
|---|---|---|
| John | 26 | $50,000 |
| Marry | 29 | $60,000 |
| Peter | 34 | $100,000 |
| Donald | 28 | $80,000 |
filter()
$store = $this->dataStore("data")
->filter("income",">",50000);
| name | age | income |
|---|---|---|
| Marry | 29 | $60,000 |
| Peter | 34 | $100,000 |
| Donald | 28 | $80,000 |
filter($callback)
$store = $this->dataStore("data")
->filter(function($row){
return $row["income"]>50000;
});
| name | age | income |
|---|---|---|
| Marry | 29 | $60,000 |
| Peter | 34 | $100,000 |
| Donald | 28 | $80,000 |
where()
$store = $this->dataStore("data")
->where("income",60000);
| name | age | income |
|---|---|---|
| Marry | 29 | $60,000 |
except()
$store = $this->dataStore("data")
->except("income","age");
| name |
|---|
| John |
| Marry |
| Peter |
| Donald |
only()
$store = $this->dataStore("data")
->only("name","income");
| name | income |
|---|---|
| John | $50,000 |
| Marry | $60,000 |
| Peter | $100,000 |
| Donald | $80,000 |
whereIn()
$store = $this->dataStore("data")
->whereIn("name",["John","Marry"]);
| name | age | income |
|---|---|---|
| John | 26 | $50,000 |
| Marry | 29 | $60,000 |
whereNotIn()
$store = $this->dataStore("data")
->whereNotIn("name",["John","Marry"]);
| name | age | income |
|---|---|---|
| Peter | 34 | $100,000 |
| Donald | 28 | $80,000 |