Skip to content

Commit 3cde97a

Browse files
committed
Replace Illuminate\Support\Carbon with Illuminate\Support\Facades\Date
1 parent 46bcfe2 commit 3cde97a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+168
-158
lines changed

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ All notable changes to `laravel-eloquent-flag` will be documented in this file.
1212
### Changed
1313

1414
- All methods are strict typed now
15-
- `Carbon\Carbon` replaced with `Illuminate\Support\Carbon`
15+
- `Carbon\Carbon` replaced with `Illuminate\Support\Facades\Date`
1616

1717
### Removed
1818

1919
- Dropped PHP 5.6, 7.0 support
20-
- Dropped Laravel 5.2, 5.3, 5.4, 5.5, 5.6 support
20+
- Dropped Laravel 5.2, 5.3, 5.4, 5.5, 5.6, 5.7 support
2121

2222
## [4.0.0] - 2018-09-09
2323

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@
5454
},
5555
"require": {
5656
"php": "^7.1.3",
57-
"illuminate/database": "5.7.*|5.8.*"
57+
"illuminate/database": "5.8.*"
5858
},
5959
"require-dev": {
6060
"friendsofphp/php-cs-fixer": "^2.10",
6161
"mockery/mockery": "^1.0",
62-
"orchestra/database": "~3.7.0|~3.8.0",
63-
"orchestra/testbench": "~3.7.0|~3.8.0",
62+
"orchestra/database": "~3.8.0",
63+
"orchestra/testbench": "~3.8.0",
6464
"phpunit/phpunit": "^7.0|^8.0"
6565
},
6666
"autoload": {

src/Scopes/Classic/AcceptedAtScope.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use Illuminate\Database\Eloquent\Builder;
1717
use Illuminate\Database\Eloquent\Model;
1818
use Illuminate\Database\Eloquent\Scope;
19-
use Illuminate\Support\Carbon;
19+
use Illuminate\Support\Facades\Date;
2020

2121
final class AcceptedAtScope implements Scope
2222
{
@@ -69,7 +69,7 @@ protected function addAccept(Builder $builder): void
6969
$builder->macro('accept', function (Builder $builder) {
7070
$builder->withRejected();
7171

72-
return $builder->update(['accepted_at' => Carbon::now()]);
72+
return $builder->update(['accepted_at' => Date::now()]);
7373
});
7474
}
7575

src/Scopes/Classic/ApprovedAtScope.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use Illuminate\Database\Eloquent\Builder;
1717
use Illuminate\Database\Eloquent\Model;
1818
use Illuminate\Database\Eloquent\Scope;
19-
use Illuminate\Support\Carbon;
19+
use Illuminate\Support\Facades\Date;
2020

2121
final class ApprovedAtScope implements Scope
2222
{
@@ -69,7 +69,7 @@ protected function addApprove(Builder $builder): void
6969
$builder->macro('approve', function (Builder $builder) {
7070
$builder->withDisapproved();
7171

72-
return $builder->update(['approved_at' => Carbon::now()]);
72+
return $builder->update(['approved_at' => Date::now()]);
7373
});
7474
}
7575

src/Scopes/Classic/InvitedAtScope.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use Illuminate\Database\Eloquent\Builder;
1717
use Illuminate\Database\Eloquent\Model;
1818
use Illuminate\Database\Eloquent\Scope;
19-
use Illuminate\Support\Carbon;
19+
use Illuminate\Support\Facades\Date;
2020

2121
final class InvitedAtScope implements Scope
2222
{
@@ -73,7 +73,7 @@ protected function addInvite(Builder $builder): void
7373
$builder->macro('invite', function (Builder $builder) {
7474
$builder->withUninvited();
7575

76-
return $builder->update(['invited_at' => Carbon::now()]);
76+
return $builder->update(['invited_at' => Date::now()]);
7777
});
7878
}
7979

src/Scopes/Classic/PublishedAtScope.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use Illuminate\Database\Eloquent\Builder;
1717
use Illuminate\Database\Eloquent\Model;
1818
use Illuminate\Database\Eloquent\Scope;
19-
use Illuminate\Support\Carbon;
19+
use Illuminate\Support\Facades\Date;
2020

2121
final class PublishedAtScope implements Scope
2222
{
@@ -73,7 +73,7 @@ protected function addPublish(Builder $builder): void
7373
$builder->macro('publish', function (Builder $builder) {
7474
$builder->withUnpublished();
7575

76-
return $builder->update(['published_at' => Carbon::now()]);
76+
return $builder->update(['published_at' => Date::now()]);
7777
});
7878
}
7979

src/Scopes/Classic/VerifiedAtScope.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use Illuminate\Database\Eloquent\Builder;
1717
use Illuminate\Database\Eloquent\Model;
1818
use Illuminate\Database\Eloquent\Scope;
19-
use Illuminate\Support\Carbon;
19+
use Illuminate\Support\Facades\Date;
2020

2121
final class VerifiedAtScope implements Scope
2222
{
@@ -73,7 +73,7 @@ protected function addVerify(Builder $builder): void
7373
$builder->macro('verify', function (Builder $builder) {
7474
$builder->withUnverified();
7575

76-
return $builder->update(['verified_at' => Carbon::now()]);
76+
return $builder->update(['verified_at' => Date::now()]);
7777
});
7878
}
7979

src/Scopes/Inverse/ArchivedAtScope.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use Illuminate\Database\Eloquent\Builder;
1717
use Illuminate\Database\Eloquent\Model;
1818
use Illuminate\Database\Eloquent\Scope;
19-
use Illuminate\Support\Carbon;
19+
use Illuminate\Support\Facades\Date;
2020

2121
final class ArchivedAtScope implements Scope
2222
{
@@ -86,7 +86,7 @@ protected function addUnarchive(Builder $builder): void
8686
protected function addArchive(Builder $builder): void
8787
{
8888
$builder->macro('archive', function (Builder $builder) {
89-
return $builder->update(['archived_at' => Carbon::now()]);
89+
return $builder->update(['archived_at' => Date::now()]);
9090
});
9191
}
9292

src/Scopes/Inverse/ClosedAtScope.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use Illuminate\Database\Eloquent\Builder;
1717
use Illuminate\Database\Eloquent\Model;
1818
use Illuminate\Database\Eloquent\Scope;
19-
use Illuminate\Support\Carbon;
19+
use Illuminate\Support\Facades\Date;
2020

2121
final class ClosedAtScope implements Scope
2222
{
@@ -82,7 +82,7 @@ protected function addOpen(Builder $builder): void
8282
protected function addClose(Builder $builder): void
8383
{
8484
$builder->macro('close', function (Builder $builder) {
85-
return $builder->update(['closed_at' => Carbon::now()]);
85+
return $builder->update(['closed_at' => Date::now()]);
8686
});
8787
}
8888

src/Scopes/Inverse/DraftedAtScope.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use Illuminate\Database\Eloquent\Builder;
1717
use Illuminate\Database\Eloquent\Model;
1818
use Illuminate\Database\Eloquent\Scope;
19-
use Illuminate\Support\Carbon;
19+
use Illuminate\Support\Facades\Date;
2020

2121
final class DraftedAtScope implements Scope
2222
{
@@ -86,7 +86,7 @@ protected function addUndraft(Builder $builder): void
8686
protected function addDraft(Builder $builder): void
8787
{
8888
$builder->macro('draft', function (Builder $builder) {
89-
return $builder->update(['drafted_at' => Carbon::now()]);
89+
return $builder->update(['drafted_at' => Date::now()]);
9090
});
9191
}
9292

0 commit comments

Comments
 (0)