Skip to content

Commit bc0064a

Browse files
Refactor: Use strict comparison in chart widget filters (alexjustesen#2498)
Co-authored-by: Alex Justesen <[email protected]>
1 parent e2bc2be commit bc0064a

File tree

6 files changed

+18
-18
lines changed

6 files changed

+18
-18
lines changed

app/Filament/Widgets/RecentDownloadChartWidget.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ protected function getData(): array
3838
$results = Result::query()
3939
->select(['id', 'download', 'created_at'])
4040
->where('status', '=', ResultStatus::Completed)
41-
->when($this->filter == '24h', function ($query) {
41+
->when($this->filter === '24h', function ($query) {
4242
$query->where('created_at', '>=', now()->subDay());
4343
})
44-
->when($this->filter == 'week', function ($query) {
44+
->when($this->filter === 'week', function ($query) {
4545
$query->where('created_at', '>=', now()->subWeek());
4646
})
47-
->when($this->filter == 'month', function ($query) {
47+
->when($this->filter === 'month', function ($query) {
4848
$query->where('created_at', '>=', now()->subMonth());
4949
})
5050
->orderBy('created_at')

app/Filament/Widgets/RecentDownloadLatencyChartWidget.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ protected function getData(): array
3636
$results = Result::query()
3737
->select(['id', 'data', 'created_at'])
3838
->where('status', '=', ResultStatus::Completed)
39-
->when($this->filter == '24h', function ($query) {
39+
->when($this->filter === '24h', function ($query) {
4040
$query->where('created_at', '>=', now()->subDay());
4141
})
42-
->when($this->filter == 'week', function ($query) {
42+
->when($this->filter === 'week', function ($query) {
4343
$query->where('created_at', '>=', now()->subWeek());
4444
})
45-
->when($this->filter == 'month', function ($query) {
45+
->when($this->filter === 'month', function ($query) {
4646
$query->where('created_at', '>=', now()->subMonth());
4747
})
4848
->orderBy('created_at')

app/Filament/Widgets/RecentJitterChartWidget.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ protected function getData(): array
3636
$results = Result::query()
3737
->select(['id', 'data', 'created_at'])
3838
->where('status', '=', ResultStatus::Completed)
39-
->when($this->filter == '24h', function ($query) {
39+
->when($this->filter === '24h', function ($query) {
4040
$query->where('created_at', '>=', now()->subDay());
4141
})
42-
->when($this->filter == 'week', function ($query) {
42+
->when($this->filter === 'week', function ($query) {
4343
$query->where('created_at', '>=', now()->subWeek());
4444
})
45-
->when($this->filter == 'month', function ($query) {
45+
->when($this->filter === 'month', function ($query) {
4646
$query->where('created_at', '>=', now()->subMonth());
4747
})
4848
->orderBy('created_at')

app/Filament/Widgets/RecentPingChartWidget.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ protected function getData(): array
3737
$results = Result::query()
3838
->select(['id', 'ping', 'created_at'])
3939
->where('status', '=', ResultStatus::Completed)
40-
->when($this->filter == '24h', function ($query) {
40+
->when($this->filter === '24h', function ($query) {
4141
$query->where('created_at', '>=', now()->subDay());
4242
})
43-
->when($this->filter == 'week', function ($query) {
43+
->when($this->filter === 'week', function ($query) {
4444
$query->where('created_at', '>=', now()->subWeek());
4545
})
46-
->when($this->filter == 'month', function ($query) {
46+
->when($this->filter === 'month', function ($query) {
4747
$query->where('created_at', '>=', now()->subMonth());
4848
})
4949
->orderBy('created_at')

app/Filament/Widgets/RecentUploadChartWidget.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ protected function getData(): array
3838
$results = Result::query()
3939
->select(['id', 'upload', 'created_at'])
4040
->where('status', '=', ResultStatus::Completed)
41-
->when($this->filter == '24h', function ($query) {
41+
->when($this->filter === '24h', function ($query) {
4242
$query->where('created_at', '>=', now()->subDay());
4343
})
44-
->when($this->filter == 'week', function ($query) {
44+
->when($this->filter === 'week', function ($query) {
4545
$query->where('created_at', '>=', now()->subWeek());
4646
})
47-
->when($this->filter == 'month', function ($query) {
47+
->when($this->filter === 'month', function ($query) {
4848
$query->where('created_at', '>=', now()->subMonth());
4949
})
5050
->orderBy('created_at')

app/Filament/Widgets/RecentUploadLatencyChartWidget.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ protected function getData(): array
3636
$results = Result::query()
3737
->select(['id', 'data', 'created_at'])
3838
->where('status', '=', ResultStatus::Completed)
39-
->when($this->filter == '24h', function ($query) {
39+
->when($this->filter === '24h', function ($query) {
4040
$query->where('created_at', '>=', now()->subDay());
4141
})
42-
->when($this->filter == 'week', function ($query) {
42+
->when($this->filter === 'week', function ($query) {
4343
$query->where('created_at', '>=', now()->subWeek());
4444
})
45-
->when($this->filter == 'month', function ($query) {
45+
->when($this->filter === 'month', function ($query) {
4646
$query->where('created_at', '>=', now()->subMonth());
4747
})
4848
->orderBy('created_at')

0 commit comments

Comments
 (0)