Skip to content

Commit 971a6ae

Browse files
committed
Merge branch 'release/4.6.0'
2 parents 4141718 + 830582e commit 971a6ae

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file. This projec
55

66
## Unreleased
77

8+
## [4.6.0] - 2025-09-30
9+
10+
### Added
11+
12+
- [#44](https://github.com/laravel-json-api/eloquent/pull/44) New `asInteger()` method added to the `DeserializesValue`
13+
trait.
14+
815
## [4.5.0] - 2025-02-24
916

1017
### Added

src/Filters/Concerns/DeserializesValue.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,20 @@ public function asBoolean(): self
4949
return $this;
5050
}
5151

52+
/**
53+
* Deserialize value as a integer.
54+
*
55+
* @return $this
56+
*/
57+
public function asInteger(): self
58+
{
59+
$this->deserializeUsing(
60+
static fn($value) => filter_var($value, FILTER_VALIDATE_INT)
61+
);
62+
63+
return $this;
64+
}
65+
5266
/**
5367
* Deserialize the value.
5468
*

0 commit comments

Comments
 (0)