Skip to content

Commit

Permalink
Merge pull request #2 from omaralalwi/bugfix-with-ago-scopes
Browse files Browse the repository at this point in the history
bugfix with ago scopes
  • Loading branch information
omaralalwi authored Aug 27, 2024
2 parents 0237d91 + c3e680f commit e5b86f6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 25 deletions.
33 changes: 10 additions & 23 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,31 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="vendor/autoload.php"
backupGlobals="false"
colors="true"
processIsolation="false"
stopOnFailure="false"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.1/phpunit.xsd"
cacheDirectory=".phpunit.cache"
backupStaticProperties="false"
>
<coverage/>
<phpunit bootstrap="vendor/autoload.php"
colors="true"
stderr="true">
<testsuites>
<testsuite name="Unit">
<directory suffix="Test.php">./tests/Unit</directory>
</testsuite>
<testsuite name="Feature">
<directory suffix="Test.php">./tests/Feature</directory>
<directory>./tests/Feature</directory>
</testsuite>
<testsuite name="Unit">
<directory>./tests/Unit</directory>
</testsuite>
</testsuites>
<php>
<env name="DB_CONNECTION" value="testing"/>
<env name="APP_KEY" value="base64:2fl+Ktvkfl+Fuz4Qp/A75G2RTiWVA/ZoKZvp6fiiM10="/>
</php>
<source>
<coverage>
<include>
<directory suffix=".php">src/</directory>
<directory suffix=".php">./src</directory>
</include>
</source>
</coverage>
</phpunit>
4 changes: 2 additions & 2 deletions src/Traits/HasDateTimeScopes.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function scopeYesterday($query, $dateField = null): Builder
*/
public function scopeOneWeekAgo($query, $dateField = null): Builder
{
return $query->whereDate($this->getDateField($dateField), '>=', now()->subDays(7));
return $query->whereDate($this->getDateField($dateField), '=', now()->subDays(7));
}

/**
Expand Down Expand Up @@ -86,7 +86,7 @@ public function scopeCurrentWeek($query, $dateField = null): Builder
*/
public function scopeOneMonthAgo($query, $dateField = null): Builder
{
return $query->whereDate($this->getDateField($dateField), '>=', now()->subDays(30));
return $query->whereDate($this->getDateField($dateField), '=', now()->subDays(30));
}

/**
Expand Down

0 comments on commit e5b86f6

Please sign in to comment.