From 828097d50f7a9f3e790da3befd906afa09a78f2c Mon Sep 17 00:00:00 2001 From: mdpoulter Date: Sun, 27 Oct 2019 16:19:43 +0200 Subject: [PATCH 1/2] Remove integer casting. --- src/Enum.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Enum.php b/src/Enum.php index ecfb222..dbb4a70 100644 --- a/src/Enum.php +++ b/src/Enum.php @@ -61,7 +61,7 @@ protected function fillAttributeFromRequest( $attribute ) { if ($request->exists($requestAttribute)) { - $model->{$attribute} = (int) $request[$requestAttribute]; + $model->{$attribute} = $request[$requestAttribute]; } } } From 8df9df12ef18c56ecd8ab6263caf1f0b134fcd26 Mon Sep 17 00:00:00 2001 From: mdpoulter Date: Sun, 27 Oct 2019 16:19:53 +0200 Subject: [PATCH 2/2] Cleanup. --- src/Enum.php | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/Enum.php b/src/Enum.php index dbb4a70..1b511c8 100644 --- a/src/Enum.php +++ b/src/Enum.php @@ -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) @@ -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) @@ -49,17 +51,14 @@ 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} = $request[$requestAttribute]; }