diff --git a/README.md b/README.md index 1c78b7f..e67cae3 100644 --- a/README.md +++ b/README.md @@ -266,7 +266,7 @@ $ghostscript = new Ghostscript('gs-binary'); ## Convert Base64 input data to files -Add the `ConvertsBase64ToFiles` trait and `base64ImageKeys` method to your form request. +Add the `ConvertsBase64ToFiles` trait and `base64FileKeys` method to your form request. ```php use Illuminate\Foundation\Http\FormRequest; @@ -276,7 +276,7 @@ class ImageRequest extends FormRequest { use ConvertsBase64ToFiles; - protected function base64ImageKeys(): array + protected function base64FileKeys(): array { return [ 'jpg_image' => 'Logo.jpg', diff --git a/src/Request/ConvertsBase64ToFiles.php b/src/Request/ConvertsBase64ToFiles.php index b83720e..d5730e6 100644 --- a/src/Request/ConvertsBase64ToFiles.php +++ b/src/Request/ConvertsBase64ToFiles.php @@ -8,12 +8,7 @@ trait ConvertsBase64ToFiles { - /** - * Specify all input keys that should be converted. - * - * @return array - */ - protected function base64ImageKeys(): array + protected function base64FileKeys(): array { return []; } @@ -27,7 +22,7 @@ protected function base64ImageKeys(): array */ protected function prepareForValidation() { - Collection::make($this->base64ImageKeys())->each(function ($filename, $key) { + Collection::make($this->base64FileKeys())->each(function ($filename, $key) { rescue(function () use ($key, $filename) { $base64Contents = $this->input($key); diff --git a/tests/Request/ConvertsBase64ToFilesTest.php b/tests/Request/ConvertsBase64ToFilesTest.php index 4bc2e9a..8d69e61 100644 --- a/tests/Request/ConvertsBase64ToFilesTest.php +++ b/tests/Request/ConvertsBase64ToFilesTest.php @@ -11,7 +11,7 @@ class ImageRequest extends FormRequest { use ConvertsBase64ToFiles; - protected function base64ImageKeys(): array + protected function base64FileKeys(): array { return [ 'png_image' => 'Logo1.png', @@ -32,7 +32,7 @@ class ZipRequest extends FormRequest { use ConvertsBase64ToFiles; - protected function base64ImageKeys(): array + protected function base64FileKeys(): array { return [ 'zip' => 'Logo.zip',