Skip to content

Commit

Permalink
Merge pull request #3 from simplesquid/fix-casting
Browse files Browse the repository at this point in the history
Fix casting
  • Loading branch information
mdpoulter authored Oct 27, 2019
2 parents 307646e + 8df9df1 commit 2cb3c88
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions src/Enum.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ class Enum extends Select
/**
* Create a new field.
*
* @param string $name
* @param string $name
* @param string|callable|null $attribute
* @param callable|null $resolveCallback
* @param callable|null $resolveCallback
*
* @return void
*/
public function __construct($name, $attribute = null, callable $resolveCallback = null)
Expand All @@ -28,6 +29,7 @@ public function __construct($name, $attribute = null, callable $resolveCallback
* Setup the Enum field with the Enum class
*
* @param string $class
*
* @return $this
*/
public function attachEnum($class)
Expand All @@ -49,19 +51,16 @@ function ($enum) {
* Hydrate the given attribute on the model based on the incoming request.
*
* @param NovaRequest $request
* @param string $requestAttribute
* @param object $model
* @param string $attribute
* @param string $requestAttribute
* @param object $model
* @param string $attribute
*
* @return void
*/
protected function fillAttributeFromRequest(
NovaRequest $request,
$requestAttribute,
$model,
$attribute
) {
protected function fillAttributeFromRequest(NovaRequest $request, $requestAttribute, $model, $attribute)
{
if ($request->exists($requestAttribute)) {
$model->{$attribute} = (int) $request[$requestAttribute];
$model->{$attribute} = $request[$requestAttribute];
}
}
}

0 comments on commit 2cb3c88

Please sign in to comment.