From e82d8be3d1bc7fbe3e4c5d5d57f3097f4875b66a Mon Sep 17 00:00:00 2001 From: StyleCI Bot Date: Tue, 11 Jul 2023 08:22:45 +0000 Subject: [PATCH] Apply fixes from StyleCI [ci skip] [skip ci] --- resources/helpers.php | 36 +++++----- resources/lang/de/errors.php | 2 +- resources/lang/de/translation.php | 84 ++++++++++++------------ resources/lang/en/errors.php | 2 +- resources/lang/en/translation.php | 80 +++++++++++----------- resources/lang/fr/errors.php | 2 +- resources/lang/fr/translation.php | 80 +++++++++++----------- resources/lang/nl/errors.php | 2 +- resources/lang/nl/translation.php | 80 +++++++++++----------- src/Http/Requests/LanguageRequest.php | 4 +- src/Http/Requests/TranslationRequest.php | 2 +- src/Rules/LanguageNotExists.php | 7 +- tests/EloquentControllerTest.php | 4 +- tests/fixtures/lang/de/validation.php | 8 +-- tests/fixtures/lang/en/products.php | 2 +- tests/fixtures/lang/en/validation.php | 8 +-- tests/fixtures/lang/es/test.php | 2 +- 17 files changed, 205 insertions(+), 200 deletions(-) diff --git a/resources/helpers.php b/resources/helpers.php index 31cdf642..01ae0111 100644 --- a/resources/helpers.php +++ b/resources/helpers.php @@ -3,12 +3,13 @@ use Illuminate\Support\Arr; use Illuminate\Support\Str; -if (! function_exists('set_active')) { +if (!function_exists('set_active')) { /** * Determine if a route is the currently active route. * - * @param string $path - * @param string $class + * @param string $path + * @param string $class + * * @return string */ function set_active($path, $class = 'active') @@ -17,12 +18,13 @@ function set_active($path, $class = 'active') } } -if (! function_exists('strs_contain')) { +if (!function_exists('strs_contain')) { /** * Determine whether any of the provided strings in the haystack contain the needle. * - * @param array $haystacks - * @param string $needle + * @param array $haystacks + * @param string $needle + * * @return bool */ function strs_contain($haystacks, $needle) @@ -41,12 +43,13 @@ function strs_contain($haystacks, $needle) } } -if (! function_exists('array_diff_assoc_recursive')) { +if (!function_exists('array_diff_assoc_recursive')) { /** * Recursively diff two arrays. * - * @param array $arrayOne - * @param array $arrayTwo + * @param array $arrayOne + * @param array $arrayTwo + * * @return array */ function array_diff_assoc_recursive($arrayOne, $arrayTwo) @@ -54,9 +57,9 @@ function array_diff_assoc_recursive($arrayOne, $arrayTwo) $difference = []; foreach ($arrayOne as $key => $value) { if (is_array($value) || $value instanceof Illuminate\Support\Collection) { - if (! isset($arrayTwo[$key])) { + if (!isset($arrayTwo[$key])) { $difference[$key] = $value; - } elseif (! (is_array($arrayTwo[$key]) || $arrayTwo[$key] instanceof Illuminate\Support\Collection)) { + } elseif (!(is_array($arrayTwo[$key]) || $arrayTwo[$key] instanceof Illuminate\Support\Collection)) { $difference[$key] = $value; } else { $new_diff = array_diff_assoc_recursive($value, $arrayTwo[$key]); @@ -64,7 +67,7 @@ function array_diff_assoc_recursive($arrayOne, $arrayTwo) $difference[$key] = $new_diff; } } - } elseif (! isset($arrayTwo[$key])) { + } elseif (!isset($arrayTwo[$key])) { $difference[$key] = $value; } } @@ -73,12 +76,13 @@ function array_diff_assoc_recursive($arrayOne, $arrayTwo) } } -if (! function_exists('str_before')) { +if (!function_exists('str_before')) { /** * Get the portion of a string before a given value. * - * @param string $subject - * @param string $search + * @param string $subject + * @param string $search + * * @return string */ function str_before($subject, $search) @@ -88,7 +92,7 @@ function str_before($subject, $search) } // Array undot -if (! function_exists('array_undot')) { +if (!function_exists('array_undot')) { /** * Expands a single level array with dot notation into a multi-dimensional array. * diff --git a/resources/lang/de/errors.php b/resources/lang/de/errors.php index 88b55e37..0f26c71d 100644 --- a/resources/lang/de/errors.php +++ b/resources/lang/de/errors.php @@ -2,5 +2,5 @@ return [ 'language_exists' => 'Die Sprache { :language } ist bereits vorhanden', - 'key_exists' => 'Der Übersetzungsschlüssel { :key } ist bereits vorhanden', + 'key_exists' => 'Der Übersetzungsschlüssel { :key } ist bereits vorhanden', ]; diff --git a/resources/lang/de/translation.php b/resources/lang/de/translation.php index 02ea8368..b8d76080 100644 --- a/resources/lang/de/translation.php +++ b/resources/lang/de/translation.php @@ -1,47 +1,47 @@ 'Sprachen', - 'language' => 'Sprache', - 'type' => 'Typ', - 'file' => 'Datei', - 'key' => 'Schlüssel', - 'prompt_language' => 'Geben Sie den Sprachcode ein, den Sie hinzufügen möchten (z.B. en).', - 'language_added' => 'Neue Sprache wurde erfolgreich hinzugefügt 🙌', + 'languages' => 'Sprachen', + 'language' => 'Sprache', + 'type' => 'Typ', + 'file' => 'Datei', + 'key' => 'Schlüssel', + 'prompt_language' => 'Geben Sie den Sprachcode ein, den Sie hinzufügen möchten (z.B. en).', + 'language_added' => 'Neue Sprache wurde erfolgreich hinzugefügt 🙌', 'prompt_language_for_key' => 'Geben Sie die Sprache für den Schlüssel ein (z.B. en)', - 'prompt_type' => 'Ist das ein Json- oder Array-Schlüssel?', - 'prompt_file' => 'In welcher Datei wird das gespeichert?', - 'prompt_key' => 'Was ist der Schlüssel für diese Übersetzung?', - 'prompt_value' => 'Was ist der Wert für diese Übersetzung', - 'type_error' => 'Übersetzungstyp muss json oder ein Array sein', - 'language_key_added' => 'Neuer Sprachenschlüssel wurde erfolgreich hinzugefügt 👏', - 'no_missing_keys' => 'Es fehlen keine Übersetzungsschlüssel in der App 🎉', - 'keys_synced' => 'Fehlende Schlüssel erfolgreich synchronisiert 🎊', - 'search' => 'Alle Übersetzungen suchen', - 'translations' => 'Übersetzung', - 'language_name' => 'Name', - 'locale' => 'locale', - 'add' => '+ Hinzufügen', - 'add_language' => 'Neue Sprache hinzufügen', - 'save' => 'save', - 'language_exists' => 'Das :attribute ist bereits vorhanden.', - 'uh_oh' => 'Etwas ist nicht ganz richtig', - 'group_single' => 'Gruppe / Single', - 'Gruppe' => 'Gruppe', - 'single' => 'single', - 'value' => 'Wert', - 'namespace' => 'Namespace', - 'synchronisieren' => 'Übersetzungen synchronisieren ⏳', - 'synced' => 'Übersetzungen wurden synchronisiert 😎', - 'add_translation' => 'Übersetzung hinzufügen', - 'translation_added' => 'Neue Übersetzung erfolgreich hinzugefügt 🙌', - 'namespace_label' => 'Namespace (optional)', - 'group_label' => 'Gruppe (optional)', - 'key_label' => 'Schlüssel', - 'value_label' => 'Wert', - 'namespace_placeholder' => 'z.B. my_package', - 'group_placeholder' => 'z.B. validation', - 'key_placeholder' => 'z.B. invalid_key', - 'value_placeholder' => 'z.B. Schlüssel müssen eine einzige Zeichenfolge sein', - 'advanced_options' => 'Erweiterte Optionen umschalten', + 'prompt_type' => 'Ist das ein Json- oder Array-Schlüssel?', + 'prompt_file' => 'In welcher Datei wird das gespeichert?', + 'prompt_key' => 'Was ist der Schlüssel für diese Übersetzung?', + 'prompt_value' => 'Was ist der Wert für diese Übersetzung', + 'type_error' => 'Übersetzungstyp muss json oder ein Array sein', + 'language_key_added' => 'Neuer Sprachenschlüssel wurde erfolgreich hinzugefügt 👏', + 'no_missing_keys' => 'Es fehlen keine Übersetzungsschlüssel in der App 🎉', + 'keys_synced' => 'Fehlende Schlüssel erfolgreich synchronisiert 🎊', + 'search' => 'Alle Übersetzungen suchen', + 'translations' => 'Übersetzung', + 'language_name' => 'Name', + 'locale' => 'locale', + 'add' => '+ Hinzufügen', + 'add_language' => 'Neue Sprache hinzufügen', + 'save' => 'save', + 'language_exists' => 'Das :attribute ist bereits vorhanden.', + 'uh_oh' => 'Etwas ist nicht ganz richtig', + 'group_single' => 'Gruppe / Single', + 'Gruppe' => 'Gruppe', + 'single' => 'single', + 'value' => 'Wert', + 'namespace' => 'Namespace', + 'synchronisieren' => 'Übersetzungen synchronisieren ⏳', + 'synced' => 'Übersetzungen wurden synchronisiert 😎', + 'add_translation' => 'Übersetzung hinzufügen', + 'translation_added' => 'Neue Übersetzung erfolgreich hinzugefügt 🙌', + 'namespace_label' => 'Namespace (optional)', + 'group_label' => 'Gruppe (optional)', + 'key_label' => 'Schlüssel', + 'value_label' => 'Wert', + 'namespace_placeholder' => 'z.B. my_package', + 'group_placeholder' => 'z.B. validation', + 'key_placeholder' => 'z.B. invalid_key', + 'value_placeholder' => 'z.B. Schlüssel müssen eine einzige Zeichenfolge sein', + 'advanced_options' => 'Erweiterte Optionen umschalten', ]; diff --git a/resources/lang/en/errors.php b/resources/lang/en/errors.php index abd5036b..539033f3 100644 --- a/resources/lang/en/errors.php +++ b/resources/lang/en/errors.php @@ -2,5 +2,5 @@ return [ 'language_exists' => 'The language { :language } already exists', - 'key_exists' => 'The translation key { :key } already exists', + 'key_exists' => 'The translation key { :key } already exists', ]; diff --git a/resources/lang/en/translation.php b/resources/lang/en/translation.php index d933a573..8c81ed59 100644 --- a/resources/lang/en/translation.php +++ b/resources/lang/en/translation.php @@ -1,45 +1,45 @@ 'Languages', - 'language' => 'Language', - 'type' => 'Type', - 'file' => 'File', - 'key' => 'Key', - 'prompt_language' => 'Enter the language code you would like to add (e.g. en)', - 'language_added' => 'New language added successfully 🙌', + 'languages' => 'Languages', + 'language' => 'Language', + 'type' => 'Type', + 'file' => 'File', + 'key' => 'Key', + 'prompt_language' => 'Enter the language code you would like to add (e.g. en)', + 'language_added' => 'New language added successfully 🙌', 'prompt_language_for_key' => 'Enter the language for the key (e.g. en)', - 'prompt_type' => 'Is this a json or array key?', - 'prompt_file' => 'Which file will this be stored in?', - 'prompt_key' => 'What is the key for this translation?', - 'prompt_value' => 'What is the value for this translation', - 'type_error' => 'Translation type must be json or array', - 'language_key_added' => 'New language key added successfully 👏', - 'no_missing_keys' => 'There are no missing translation keys in the app 🎉', - 'keys_synced' => 'Missing keys synchronised successfully 🎊', - 'search' => 'Search all translations', - 'translations' => 'Translation', - 'language_name' => 'Name', - 'locale' => 'Locale', - 'add' => '+ Add', - 'add_language' => 'Add a new language', - 'save' => 'Save', - 'language_exists' => 'The :attribute already exists.', - 'uh_oh' => 'Something\'s not quite right', - 'group_single' => 'Group / Single', - 'group' => 'Group', - 'single' => 'Single', - 'value' => 'Value', - 'namespace' => 'Namespace', - 'add_translation' => 'Add a translation', - 'translation_added' => 'New translation added successfull 🙌', - 'namespace_label' => 'Namespace (Optional)', - 'group_label' => 'Group (Optional)', - 'key_label' => 'Key', - 'value_label' => 'Value', - 'namespace_placeholder' => 'e.g. my_package', - 'group_placeholder' => 'e.g. validation', - 'key_placeholder' => 'e.g. invalid_key', - 'value_placeholder' => 'e.g. Keys must be a single string', - 'advanced_options' => 'Toggle advanced options', + 'prompt_type' => 'Is this a json or array key?', + 'prompt_file' => 'Which file will this be stored in?', + 'prompt_key' => 'What is the key for this translation?', + 'prompt_value' => 'What is the value for this translation', + 'type_error' => 'Translation type must be json or array', + 'language_key_added' => 'New language key added successfully 👏', + 'no_missing_keys' => 'There are no missing translation keys in the app 🎉', + 'keys_synced' => 'Missing keys synchronised successfully 🎊', + 'search' => 'Search all translations', + 'translations' => 'Translation', + 'language_name' => 'Name', + 'locale' => 'Locale', + 'add' => '+ Add', + 'add_language' => 'Add a new language', + 'save' => 'Save', + 'language_exists' => 'The :attribute already exists.', + 'uh_oh' => 'Something\'s not quite right', + 'group_single' => 'Group / Single', + 'group' => 'Group', + 'single' => 'Single', + 'value' => 'Value', + 'namespace' => 'Namespace', + 'add_translation' => 'Add a translation', + 'translation_added' => 'New translation added successfull 🙌', + 'namespace_label' => 'Namespace (Optional)', + 'group_label' => 'Group (Optional)', + 'key_label' => 'Key', + 'value_label' => 'Value', + 'namespace_placeholder' => 'e.g. my_package', + 'group_placeholder' => 'e.g. validation', + 'key_placeholder' => 'e.g. invalid_key', + 'value_placeholder' => 'e.g. Keys must be a single string', + 'advanced_options' => 'Toggle advanced options', ]; diff --git a/resources/lang/fr/errors.php b/resources/lang/fr/errors.php index f4de4750..9ac984cd 100644 --- a/resources/lang/fr/errors.php +++ b/resources/lang/fr/errors.php @@ -1,6 +1,6 @@ 'La clé de traduction { :key } existe déjà', + 'key_exists' => 'La clé de traduction { :key } existe déjà', 'language_exists' => 'La langue { :language } existe déjà', ]; diff --git a/resources/lang/fr/translation.php b/resources/lang/fr/translation.php index efb8a2de..ac9f99a3 100644 --- a/resources/lang/fr/translation.php +++ b/resources/lang/fr/translation.php @@ -1,45 +1,45 @@ '+ Ajouter', - 'add_language' => 'Ajouter une nouvelle langue', - 'add_translation' => 'Ajouter une traduction', - 'advanced_options' => 'Afficher les options avancées', - 'file' => 'Fichier', - 'group' => 'Groupe', - 'group_label' => 'Groupe (Optionnel)', - 'group_placeholder' => 'Ex: validation', - 'group_single' => 'Groupe / Unique', - 'key' => 'Clé', - 'key_label' => 'Clé', - 'key_placeholder' => 'Par exemple : invalid_key', - 'keys_synced' => 'Clés manquantes synchronisées avec succès 🎊', - 'language' => 'Langue', - 'language_added' => 'Nouvelle langue ajoutée avec succés 🙌', - 'language_exists' => 'Le :attribute existe déjà.', - 'language_key_added' => 'Nouvelle clé dans la langue ajoutée avec succès 👏', - 'language_name' => 'Nom', - 'languages' => 'Langues', - 'locale' => 'Locale', - 'namespace' => 'Namespace', - 'namespace_label' => 'Namespace (Optionnel)', - 'namespace_placeholder' => 'Par exemple : my_package', - 'no_missing_keys' => 'Il ne manque aucune clé de traduction dans l\'application 🎉', - 'prompt_file' => 'Dans quel fichier sera t\'elle stockée ?', - 'prompt_key' => 'Quelle est la clé de cette traduction ?', - 'prompt_language' => 'Entrez le code langue que vous aimeriez ajouter (Ex: fr)', + 'add' => '+ Ajouter', + 'add_language' => 'Ajouter une nouvelle langue', + 'add_translation' => 'Ajouter une traduction', + 'advanced_options' => 'Afficher les options avancées', + 'file' => 'Fichier', + 'group' => 'Groupe', + 'group_label' => 'Groupe (Optionnel)', + 'group_placeholder' => 'Ex: validation', + 'group_single' => 'Groupe / Unique', + 'key' => 'Clé', + 'key_label' => 'Clé', + 'key_placeholder' => 'Par exemple : invalid_key', + 'keys_synced' => 'Clés manquantes synchronisées avec succès 🎊', + 'language' => 'Langue', + 'language_added' => 'Nouvelle langue ajoutée avec succés 🙌', + 'language_exists' => 'Le :attribute existe déjà.', + 'language_key_added' => 'Nouvelle clé dans la langue ajoutée avec succès 👏', + 'language_name' => 'Nom', + 'languages' => 'Langues', + 'locale' => 'Locale', + 'namespace' => 'Namespace', + 'namespace_label' => 'Namespace (Optionnel)', + 'namespace_placeholder' => 'Par exemple : my_package', + 'no_missing_keys' => 'Il ne manque aucune clé de traduction dans l\'application 🎉', + 'prompt_file' => 'Dans quel fichier sera t\'elle stockée ?', + 'prompt_key' => 'Quelle est la clé de cette traduction ?', + 'prompt_language' => 'Entrez le code langue que vous aimeriez ajouter (Ex: fr)', 'prompt_language_for_key' => 'Entrez la langue pour la clé (Ex: fr)', - 'prompt_type' => 'Est-ce une clé Json ou Array ?', - 'prompt_value' => 'Quelle est la valeur de la traduction', - 'save' => 'Sauvegarder', - 'search' => 'Rechercher toutes les traductions', - 'single' => 'Unique', - 'translation_added' => 'Nouvelle traduction ajoutée avec succès 🙌', - 'translations' => 'Traduction', - 'type' => 'Type', - 'type_error' => 'Le type de traduction doit être en json ou en array', - 'uh_oh' => 'Quelque chose ne fonctionne pas', - 'value' => 'Valeur', - 'value_label' => 'Valeur', - 'value_placeholder' => 'Par exemple : Les clés doivent être une seule chaîne', + 'prompt_type' => 'Est-ce une clé Json ou Array ?', + 'prompt_value' => 'Quelle est la valeur de la traduction', + 'save' => 'Sauvegarder', + 'search' => 'Rechercher toutes les traductions', + 'single' => 'Unique', + 'translation_added' => 'Nouvelle traduction ajoutée avec succès 🙌', + 'translations' => 'Traduction', + 'type' => 'Type', + 'type_error' => 'Le type de traduction doit être en json ou en array', + 'uh_oh' => 'Quelque chose ne fonctionne pas', + 'value' => 'Valeur', + 'value_label' => 'Valeur', + 'value_placeholder' => 'Par exemple : Les clés doivent être une seule chaîne', ]; diff --git a/resources/lang/nl/errors.php b/resources/lang/nl/errors.php index 5205c2e6..8c97af73 100644 --- a/resources/lang/nl/errors.php +++ b/resources/lang/nl/errors.php @@ -2,5 +2,5 @@ return [ 'language_exists' => 'De taal { :language } bestaat al', - 'key_exists' => 'De vertaalsleutel { :key } bestaat al', + 'key_exists' => 'De vertaalsleutel { :key } bestaat al', ]; diff --git a/resources/lang/nl/translation.php b/resources/lang/nl/translation.php index d4ed8290..af7b974b 100644 --- a/resources/lang/nl/translation.php +++ b/resources/lang/nl/translation.php @@ -1,45 +1,45 @@ 'Talen', - 'language' => 'Taal', - 'type' => 'Type', - 'file' => 'Bestand', - 'key' => 'Sleutel', - 'prompt_language' => 'Voer de taalcode in die u wilt toevoegen (bijvoorbeeld: en)', - 'language_added' => 'Nieuwe taal met succes toegevoegd 🙌', + 'languages' => 'Talen', + 'language' => 'Taal', + 'type' => 'Type', + 'file' => 'Bestand', + 'key' => 'Sleutel', + 'prompt_language' => 'Voer de taalcode in die u wilt toevoegen (bijvoorbeeld: en)', + 'language_added' => 'Nieuwe taal met succes toegevoegd 🙌', 'prompt_language_for_key' => 'Voer de taal voor de sleutel in (bijvoorbeeld: en)', - 'prompt_type' => 'Is dit een json- of arraysleutel?', - 'prompt_file' => 'In welk bestand wordt dit opgeslagen?', - 'prompt_key' => 'Wat is de sleutel voor deze vertaling?', - 'prompt_value' => 'Wat is de text voor deze vertaling', - 'type_error' => 'Het vertaaltype moet json of array zijn', - 'language_key_added' => 'Nieuwe taalcode toegevoegd 👏', - 'no_missing_keys' => 'Er zijn geen ontbrekende vertaalsleutels in de app 🎉', - 'keys_synced' => 'Ontbrekende toetsen gesynchroniseerd met succes 🎊', - 'search' => 'Doorzoek alle vertalingen', - 'translations' => 'Vertaling', - 'language_name' => 'Naam', - 'locale' => 'locale', - 'add' => '+ Toevoegen', - 'add_language' => 'Voeg een nieuwe taal toe', - 'save' => 'Opslaan', - 'language_exists' => 'Het kenmerk :attribute bestaat al.', - 'uh_oh' => 'Er klopt iets niet helemaal', - 'group_single' => 'Groep / Enkelvoudig', - 'group' => 'Groep', - 'single' => 'Enkelvoudig', - 'value' => 'Waarde', - 'namespace' => 'Namespace', - 'add_translation' => 'Voeg een vertaling toe', - 'translation_added' => 'Nieuwe vertaling succesvol toegevoegd 🙌', - 'namespace_label' => 'Namespace (optioneel)', - 'group_label' => 'Groep (optioneel)', - 'key_label' => 'Sleutel', - 'value_label' => 'Waarde', - 'namespace_placeholder' => 'bijv. Mijn_pakket', - 'group_placeholder' => 'bijv. bevestiging', - 'key_placeholder' => 'bijv. ongeldige sleutel', - 'value_placeholder' => 'bijv. Sleutels mogen geen spaties bevatten', - 'advanced_options' => 'Schakel geavanceerde opties in', + 'prompt_type' => 'Is dit een json- of arraysleutel?', + 'prompt_file' => 'In welk bestand wordt dit opgeslagen?', + 'prompt_key' => 'Wat is de sleutel voor deze vertaling?', + 'prompt_value' => 'Wat is de text voor deze vertaling', + 'type_error' => 'Het vertaaltype moet json of array zijn', + 'language_key_added' => 'Nieuwe taalcode toegevoegd 👏', + 'no_missing_keys' => 'Er zijn geen ontbrekende vertaalsleutels in de app 🎉', + 'keys_synced' => 'Ontbrekende toetsen gesynchroniseerd met succes 🎊', + 'search' => 'Doorzoek alle vertalingen', + 'translations' => 'Vertaling', + 'language_name' => 'Naam', + 'locale' => 'locale', + 'add' => '+ Toevoegen', + 'add_language' => 'Voeg een nieuwe taal toe', + 'save' => 'Opslaan', + 'language_exists' => 'Het kenmerk :attribute bestaat al.', + 'uh_oh' => 'Er klopt iets niet helemaal', + 'group_single' => 'Groep / Enkelvoudig', + 'group' => 'Groep', + 'single' => 'Enkelvoudig', + 'value' => 'Waarde', + 'namespace' => 'Namespace', + 'add_translation' => 'Voeg een vertaling toe', + 'translation_added' => 'Nieuwe vertaling succesvol toegevoegd 🙌', + 'namespace_label' => 'Namespace (optioneel)', + 'group_label' => 'Groep (optioneel)', + 'key_label' => 'Sleutel', + 'value_label' => 'Waarde', + 'namespace_placeholder' => 'bijv. Mijn_pakket', + 'group_placeholder' => 'bijv. bevestiging', + 'key_placeholder' => 'bijv. ongeldige sleutel', + 'value_placeholder' => 'bijv. Sleutels mogen geen spaties bevatten', + 'advanced_options' => 'Schakel geavanceerde opties in', ]; diff --git a/src/Http/Requests/LanguageRequest.php b/src/Http/Requests/LanguageRequest.php index 5228f8d2..f72b038a 100644 --- a/src/Http/Requests/LanguageRequest.php +++ b/src/Http/Requests/LanguageRequest.php @@ -15,8 +15,8 @@ class LanguageRequest extends FormRequest public function rules() { return [ - 'name' => 'nullable|string', - 'locale' => ['required', new LanguageNotExists], + 'name' => 'nullable|string', + 'locale' => ['required', new LanguageNotExists()], ]; } } diff --git a/src/Http/Requests/TranslationRequest.php b/src/Http/Requests/TranslationRequest.php index 0ed928f5..70edf77f 100644 --- a/src/Http/Requests/TranslationRequest.php +++ b/src/Http/Requests/TranslationRequest.php @@ -14,7 +14,7 @@ class TranslationRequest extends FormRequest public function rules() { return [ - 'key' => 'required', + 'key' => 'required', 'value' => 'required', ]; } diff --git a/src/Rules/LanguageNotExists.php b/src/Rules/LanguageNotExists.php index f232ccc7..844d7c58 100644 --- a/src/Rules/LanguageNotExists.php +++ b/src/Rules/LanguageNotExists.php @@ -10,15 +10,16 @@ class LanguageNotExists implements Rule /** * Determine if the validation rule passes. * - * @param string $attribute - * @param mixed $value + * @param string $attribute + * @param mixed $value + * * @return bool */ public function passes($attribute, $value) { $translation = app()->make(Translation::class); - return ! $translation->languageExists($value); + return !$translation->languageExists($value); } /** diff --git a/tests/EloquentControllerTest.php b/tests/EloquentControllerTest.php index 06b54f1e..1aa8b828 100644 --- a/tests/EloquentControllerTest.php +++ b/tests/EloquentControllerTest.php @@ -77,8 +77,8 @@ $this->assertDatabaseHas('translations', [ 'language_id' => Language::where('language', config('app.locale'))->first()->id, - 'key' => 'joe', - 'value' => 'is cool', + 'key' => 'joe', + 'value' => 'is cool', ]); }); diff --git a/tests/fixtures/lang/de/validation.php b/tests/fixtures/lang/de/validation.php index 35db97d2..3d1d977b 100644 --- a/tests/fixtures/lang/de/validation.php +++ b/tests/fixtures/lang/de/validation.php @@ -2,10 +2,10 @@ return [ 'filled' => 'The :attribute field must have a value.', - 'gt' => [ - 'array' => 'The :attribute must have more than :value items.', - 'file' => 'The :attribute must be greater than :value kilobytes.', + 'gt' => [ + 'array' => 'The :attribute must have more than :value items.', + 'file' => 'The :attribute must be greater than :value kilobytes.', 'numeric' => 'The :attribute must be greater than :value.', - 'string' => 'The :attribute must be greater than :value characters.', + 'string' => 'The :attribute must be greater than :value characters.', ], ]; diff --git a/tests/fixtures/lang/en/products.php b/tests/fixtures/lang/en/products.php index 9100758f..a3c7698d 100644 --- a/tests/fixtures/lang/en/products.php +++ b/tests/fixtures/lang/en/products.php @@ -3,7 +3,7 @@ return [ 'products' => [ 'product_one' => [ - 'title' => 'Product 1', + 'title' => 'Product 1', 'description' => 'This is product one', ], ], diff --git a/tests/fixtures/lang/en/validation.php b/tests/fixtures/lang/en/validation.php index 20aab8d6..1057d1ae 100644 --- a/tests/fixtures/lang/en/validation.php +++ b/tests/fixtures/lang/en/validation.php @@ -2,10 +2,10 @@ return [ 'before_or_equal' => 'The :attribute must be a date before or equal to :date.', - 'between' => [ - 'array' => 'The :attribute must have between :min and :max items.', - 'file' => 'The :attribute must be between :min and :max kilobytes.', + 'between' => [ + 'array' => 'The :attribute must have between :min and :max items.', + 'file' => 'The :attribute must be between :min and :max kilobytes.', 'numeric' => 'The :attribute must be between :min and :max.', - 'string' => 'The :attribute must be between :min and :max characters.', + 'string' => 'The :attribute must be between :min and :max characters.', ], ]; diff --git a/tests/fixtures/lang/es/test.php b/tests/fixtures/lang/es/test.php index f086e308..a4f35811 100644 --- a/tests/fixtures/lang/es/test.php +++ b/tests/fixtures/lang/es/test.php @@ -1,6 +1,6 @@ 'Hola!', + 'hello' => 'Hola!', 'whats_up' => '¡Qué pasa!', ];