Skip to content

Commit

Permalink
Merge branch 'main' of github.com:laracraft-tech/laravel-date-scopes
Browse files Browse the repository at this point in the history
  • Loading branch information
Sairahcaz committed Oct 12, 2023
2 parents 7eb4ba6 + 703448c commit bf1b183
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

All notable changes to `laravel-date-scopes` will be documented in this file.

## v2.0.0 - 2023-10-12

### What's Changed

- you can now pass `startFrom` as a parameter to query between certain ranges. For instance: `Transaction::ofLastYear(startFrom: '2020-01-01')`. You may need to change the order of your arguments or use named arguments. Checkout [UPGRADING](https://github.com/laracraft-tech/laravel-date-scopes/blob/main/UPGRADING.md) file for that.

## v1.1.1 - 2023-05-02

### What's Changed
Expand Down
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,15 @@ class Transaction extends Model
use DateScopes;
}

Transaction::ofToday(); // query transactions created today
Transaction::ofLastWeek(); // query transactions created during the last week
Transaction::monthToDate(); // query transactions created during the start of the current month till now
Transaction::ofLastYear(startFrom: '2020-01-01') // query transactions created during the last year, starting from 2020
// query transactions created today
Transaction::ofToday();
// query transactions created during the last week
Transaction::ofLastWeek();
// query transactions created during the start of the current month till now
Transaction::monthToDate();
// query transactions created during the last year, start from 2020
Transaction::ofLastYear(startFrom: '2020-01-01');

// ... and much more scopes are available (see below)

// For sure, you can chain any Builder function you want here.
Expand All @@ -34,6 +39,10 @@ Transaction::ofLastWeek()->avg('amount');

- [`Installation`](#installation)
- [`Configuration`](#configuration)
- [`Global configuration`](#global-configuration)
- [`Fluent date range configuration`](#fluent-date-range-configuration)
- [`Fluent created_at column configuration`](#fluent-date-range-configuration)
- [`Custom start date`](#custom-start-date)
- [`Scopes`](#scopes)

## Installation
Expand Down

0 comments on commit bf1b183

Please sign in to comment.