Skip to content
This repository was archived by the owner on Feb 15, 2023. It is now read-only.

Commit 0cd442e

Browse files
committed
Version dump
1 parent c4bf61c commit 0cd442e

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

CHANGELOG.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [2.1.1] - 2021-07-09
11+
12+
## Changed
13+
14+
- `Model::status()` query scope now accepts enum instances
15+
1016
## [2.1.0] - 2021-07-09
1117

1218
## Changed
1319

14-
- Model::hasStatus() now accepts enum instances
20+
- `Model::hasStatus()` now accepts enum instances
1521
- Required package `spatie/enum` upgraded to v3
1622
- A lot of simplification all over the place
1723
- Deprecated static method `Status::getDefault()` use instead `Status::defaultFrom($model)` query scope

src/Traits/HasStatuses.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -246,14 +246,14 @@ public static function getDefaultStatus($column = 'name')
246246
* List all resources of a specified status.
247247
*
248248
* @param \Illuminate\Database\Eloquent\Builder $query
249-
* @param mixed $value
249+
* @param string|\Spatie\Enum\Enum $value
250250
*
251251
* @return Illuminate\Database\Eloquent\Builder
252252
*/
253253
public function scopeStatus(Builder $query, $name)
254254
{
255255
return $query->whereHas('status', function (Builder $query) use ($name) {
256-
$query->where('name', 'like', $name);
256+
$query->where('name', 'like', $name instanceof Enum ? $name->label : $name);
257257
});
258258
}
259259

0 commit comments

Comments
 (0)