Skip to content

Commit

Permalink
Merge pull request #12 from sharpstream/master
Browse files Browse the repository at this point in the history
Can no longer pass null to strpos
  • Loading branch information
klaude authored May 1, 2024
2 parents 2cac558 + 74a359a commit f350af6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
14 changes: 9 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
"name": "klaude/eloquent-preferences",
"type": "library",
"description": "Preferences for Laravel Eloquent models",
"keywords": ["laravel", "eloquent", "preferences"],
"keywords": [
"laravel",
"eloquent",
"preferences"
],
"homepage": "https://github.com/klaude/eloquent-preferences",
"license": "MIT",
"authors": [
Expand All @@ -13,8 +17,8 @@
],
"require": {
"ext-json": "*",
"illuminate/database": "~5|~6.0|~7.0|~8.0",
"illuminate/support": "~5|~6.0|~7.0|~8.0"
"illuminate/database": "~5|~6.0|~7.0|~8.0|~9.0|~10.0|~11.0",
"illuminate/support": "~5|~6.0|~7.0|~8.0|~9.0|~10.0|~11.0"
},
"autoload": {
"psr-4": {
Expand All @@ -23,12 +27,12 @@
},
"require-dev": {
"ext-pdo": "*",
"illuminate/events": "~5|~6.0|~7.0|~8.0",
"illuminate/events": "~5|~6.0|~7.0|~8.0|~9.0|~10.0",
"phpunit/phpunit": "~5.0|~4.8"
},
"autoload-dev": {
"psr-4": {
"KLaude\\EloquentPreferences\\Tests\\": "tests/"
}
}
}
}
2 changes: 1 addition & 1 deletion src/HasPreferences.php
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ protected function castPreferenceValue($preference, $value)
}

// Case Eloquent >= 5.7 compatible types
if (method_exists($this, 'asDecimal') && strpos($castTo, 'decimal:') === 0) {
if (method_exists($this, 'asDecimal') && $castTo && strpos($castTo, 'decimal:') === 0) {
return $this->asDecimal($value, explode(':', $castTo, 2)[1]);
}

Expand Down

0 comments on commit f350af6

Please sign in to comment.