This repository was archived by the owner on Feb 15, 2023. It is now read-only.
File tree 2 files changed +9
-3
lines changed
2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -7,11 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
8
8
## [ Unreleased]
9
9
10
+ ## [ 2.1.1] - 2021-07-09
11
+
12
+ ## Changed
13
+
14
+ - ` Model::status() ` query scope now accepts enum instances
15
+
10
16
## [ 2.1.0] - 2021-07-09
11
17
12
18
## Changed
13
19
14
- - Model::hasStatus() now accepts enum instances
20
+ - ` Model::hasStatus() ` now accepts enum instances
15
21
- Required package ` spatie/enum ` upgraded to v3
16
22
- A lot of simplification all over the place
17
23
- Deprecated static method ` Status::getDefault() ` use instead ` Status::defaultFrom($model) ` query scope
Original file line number Diff line number Diff line change @@ -246,14 +246,14 @@ public static function getDefaultStatus($column = 'name')
246
246
* List all resources of a specified status.
247
247
*
248
248
* @param \Illuminate\Database\Eloquent\Builder $query
249
- * @param mixed $value
249
+ * @param string|\Spatie\Enum\Enum $value
250
250
*
251
251
* @return Illuminate\Database\Eloquent\Builder
252
252
*/
253
253
public function scopeStatus (Builder $ query , $ name )
254
254
{
255
255
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 );
257
257
});
258
258
}
259
259
You can’t perform that action at this time.
0 commit comments