From 0a9f7ab0046a0937fcc2d2a812fd9c73c7b23988 Mon Sep 17 00:00:00 2001 From: aslan Date: Mon, 4 Mar 2024 17:24:12 +0300 Subject: [PATCH] add locale for requests and position helper --- README.md | 1 - app/Helpers/PositionHelper.php | 15 ++ .../admin/Catalog/FacultyController.php | 4 +- .../admin/Catalog/StoreFacultyRequest.php | 4 +- composer.json | 15 +- composer.lock | 52 ++++- config/app.php | 6 +- lang/en/auth.php | 20 ++ lang/en/pagination.php | 19 ++ lang/en/passwords.php | 22 ++ lang/en/requests.php | 6 + lang/en/tooltips.php | 5 + lang/en/validation.php | 193 ++++++++++++++++++ lang/ru/requests.php | 5 + lang/ru/tooltips.php | 5 + lang/ru/validation.php | 193 ++++++++++++++++++ resources/js/app.js | 2 +- .../admin/catalog/faculty/create.blade.php | 18 +- .../views/layouts/admin_layout.blade.php | 1 + resources/views/layouts/tooltips.blade.php | 4 + 20 files changed, 567 insertions(+), 23 deletions(-) create mode 100644 app/Helpers/PositionHelper.php create mode 100644 lang/en/auth.php create mode 100644 lang/en/pagination.php create mode 100644 lang/en/passwords.php create mode 100644 lang/en/requests.php create mode 100644 lang/en/tooltips.php create mode 100644 lang/en/validation.php create mode 100644 lang/ru/requests.php create mode 100644 lang/ru/tooltips.php create mode 100644 lang/ru/validation.php create mode 100644 resources/views/layouts/tooltips.blade.php diff --git a/README.md b/README.md index fb8085f..18d7cfb 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,6 @@ git clone http://172.17.254.104/aslan/applicant-site.git cd applicant-site make setup ``` -2255 ## Project start local diff --git a/app/Helpers/PositionHelper.php b/app/Helpers/PositionHelper.php new file mode 100644 index 0000000..9564f73 --- /dev/null +++ b/app/Helpers/PositionHelper.php @@ -0,0 +1,15 @@ += 254 ? 255 : $maxPosition + 1; + + } +} diff --git a/app/Http/Controllers/admin/Catalog/FacultyController.php b/app/Http/Controllers/admin/Catalog/FacultyController.php index 0bec55f..269ed9d 100644 --- a/app/Http/Controllers/admin/Catalog/FacultyController.php +++ b/app/Http/Controllers/admin/Catalog/FacultyController.php @@ -11,6 +11,7 @@ use Illuminate\Contracts\View\Factory; use Illuminate\Contracts\View\View; use Illuminate\Foundation\Application; use Illuminate\Http\RedirectResponse; +use Illuminate\Support\Str; class FacultyController extends Controller { @@ -30,11 +31,12 @@ class FacultyController extends Controller { $validated = $request->validated(); + $slug = $validated['slug'] === null ? Str::slug($validated['name']) : $validated['slug']; $faculty = new Faculty(); $faculty->name = $validated['name']; $faculty->description = $validated['description']; $faculty->position = $validated['position']; - $faculty->slug = $validated['slug']; + $faculty->slug = $slug; $faculty->educational_institution_id = $validated['educational_institution_id']; $faculty->save(); diff --git a/app/Http/Requests/admin/Catalog/StoreFacultyRequest.php b/app/Http/Requests/admin/Catalog/StoreFacultyRequest.php index a5789a1..975b53e 100644 --- a/app/Http/Requests/admin/Catalog/StoreFacultyRequest.php +++ b/app/Http/Requests/admin/Catalog/StoreFacultyRequest.php @@ -17,8 +17,8 @@ class StoreFacultyRequest extends FormRequest return [ 'position' => 'required|int|numeric|max:255', 'name' => 'required|string|max:255|unique:faculties,name', - 'description' => 'string', - 'slug' => 'required|string|max:255|unique:faculties,slug', + 'description' => 'nullable|string', + 'slug' => 'nullable|string|max:255', 'educational_institution_id' => 'required|int|numeric|max:1000' ]; } diff --git a/composer.json b/composer.json index 3c5595e..6237103 100644 --- a/composer.json +++ b/composer.json @@ -9,25 +9,26 @@ "license": "MIT", "require": { "php": "^8.3", + "fakerphp/faker": "^1.23.1", "guzzlehttp/guzzle": "^7.8.1", "imangazaliev/didom": "^2.0.1", - "laravel/framework": "^10.43.0", + "laravel/framework": "^10.44.0", "laravel/sanctum": "^3.3.3", "laravel/tinker": "^2.9.0", "laravel/ui": "^4.4.0", "laravelcollective/html": "^6.4.1", "league/flysystem": "^3.24.0", - "fakerphp/faker": "^1.23.1" + "twbs/bootstrap": "5.2.3" }, "require-dev": { - "laravel/breeze": "^1.28.1", - "laravel/pint": "^1.13.10", - "laravel/sail": "^1.27.3", + "laravel/breeze": "^1.28.2", + "laravel/pint": "^1.13.11", + "laravel/sail": "^1.27.4", "mockery/mockery": "^1.6.7", "nunomaduro/collision": "^7.10.0", "phpunit/phpunit": "^10.5.10", - "spatie/laravel-ignition": "^2.4.1", - "barryvdh/laravel-ide-helper": "^2.13.0", + "spatie/laravel-ignition": "^2.4.2", + "barryvdh/laravel-ide-helper": "^2.15.1", "squizlabs/php_codesniffer": "^3.8.1", "phpstan/phpstan": "^1.10.57" }, diff --git a/composer.lock b/composer.lock index f536b31..69d472d 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "5cf86f441bf56b881a8a88e4cd9e4af6", + "content-hash": "8d490f3e9360173e41450245a26f94f7", "packages": [ { "name": "brick/math", @@ -5718,6 +5718,56 @@ }, "time": "2023-12-08T13:03:43+00:00" }, + { + "name": "twbs/bootstrap", + "version": "v5.2.3", + "source": { + "type": "git", + "url": "https://github.com/twbs/bootstrap.git", + "reference": "cb021439c683d9805e2864c58095b92d405e9b11" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/twbs/bootstrap/zipball/cb021439c683d9805e2864c58095b92d405e9b11", + "reference": "cb021439c683d9805e2864c58095b92d405e9b11", + "shasum": "" + }, + "replace": { + "twitter/bootstrap": "self.version" + }, + "type": "library", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mark Otto", + "email": "markdotto@gmail.com" + }, + { + "name": "Jacob Thornton", + "email": "jacobthornton@gmail.com" + } + ], + "description": "The most popular front-end framework for developing responsive, mobile first projects on the web.", + "homepage": "https://getbootstrap.com/", + "keywords": [ + "JS", + "css", + "framework", + "front-end", + "mobile-first", + "responsive", + "sass", + "web" + ], + "support": { + "issues": "https://github.com/twbs/bootstrap/issues", + "source": "https://github.com/twbs/bootstrap/tree/v5.2.3" + }, + "time": "2022-11-21T18:19:01+00:00" + }, { "name": "vlucas/phpdotenv", "version": "v5.6.0", diff --git a/config/app.php b/config/app.php index 56258ee..480b374 100644 --- a/config/app.php +++ b/config/app.php @@ -83,7 +83,7 @@ return [ | */ - 'locale' => 'en', + 'locale' => 'ru', /* |-------------------------------------------------------------------------- @@ -96,7 +96,7 @@ return [ | */ - 'fallback_locale' => 'en', + 'fallback_locale' => 'ru', /* |-------------------------------------------------------------------------- @@ -109,7 +109,7 @@ return [ | */ - 'faker_locale' => 'en_US', + 'faker_locale' => 'ru_RU', /* |-------------------------------------------------------------------------- diff --git a/lang/en/auth.php b/lang/en/auth.php new file mode 100644 index 0000000..6598e2c --- /dev/null +++ b/lang/en/auth.php @@ -0,0 +1,20 @@ + 'These credentials do not match our records.', + 'password' => 'The provided password is incorrect.', + 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.', + +]; diff --git a/lang/en/pagination.php b/lang/en/pagination.php new file mode 100644 index 0000000..d481411 --- /dev/null +++ b/lang/en/pagination.php @@ -0,0 +1,19 @@ + '« Previous', + 'next' => 'Next »', + +]; diff --git a/lang/en/passwords.php b/lang/en/passwords.php new file mode 100644 index 0000000..f1223bd --- /dev/null +++ b/lang/en/passwords.php @@ -0,0 +1,22 @@ + 'Your password has been reset.', + 'sent' => 'We have emailed your password reset link.', + 'throttled' => 'Please wait before retrying.', + 'token' => 'This password reset token is invalid.', + 'user' => "We can't find a user with that email address.", + +]; diff --git a/lang/en/requests.php b/lang/en/requests.php new file mode 100644 index 0000000..df7cf9d --- /dev/null +++ b/lang/en/requests.php @@ -0,0 +1,6 @@ + 'Поле :attribute обязательно.', + 'unique' => ':attribute уже занят.', +]; diff --git a/lang/en/tooltips.php b/lang/en/tooltips.php new file mode 100644 index 0000000..6ef187c --- /dev/null +++ b/lang/en/tooltips.php @@ -0,0 +1,5 @@ + '2', +]; diff --git a/lang/en/validation.php b/lang/en/validation.php new file mode 100644 index 0000000..290e845 --- /dev/null +++ b/lang/en/validation.php @@ -0,0 +1,193 @@ + 'The :attribute field must be accepted.', + 'accepted_if' => 'The :attribute field must be accepted when :other is :value.', + 'active_url' => 'The :attribute field must be a valid URL.', + 'after' => 'The :attribute field must be a date after :date.', + 'after_or_equal' => 'The :attribute field must be a date after or equal to :date.', + 'alpha' => 'The :attribute field must only contain letters.', + 'alpha_dash' => 'The :attribute field must only contain letters, numbers, dashes, and underscores.', + 'alpha_num' => 'The :attribute field must only contain letters and numbers.', + 'array' => 'The :attribute field must be an array.', + 'ascii' => 'The :attribute field must only contain single-byte alphanumeric characters and symbols.', + 'before' => 'The :attribute field must be a date before :date.', + 'before_or_equal' => 'The :attribute field must be a date before or equal to :date.', + 'between' => [ + 'array' => 'The :attribute field must have between :min and :max items.', + 'file' => 'The :attribute field must be between :min and :max kilobytes.', + 'numeric' => 'The :attribute field must be between :min and :max.', + 'string' => 'The :attribute field must be between :min and :max characters.', + ], + 'boolean' => 'The :attribute field must be true or false.', + 'can' => 'The :attribute field contains an unauthorized value.', + 'confirmed' => 'The :attribute field confirmation does not match.', + 'current_password' => 'The password is incorrect.', + 'date' => 'The :attribute field must be a valid date.', + 'date_equals' => 'The :attribute field must be a date equal to :date.', + 'date_format' => 'The :attribute field must match the format :format.', + 'decimal' => 'The :attribute field must have :decimal decimal places.', + 'declined' => 'The :attribute field must be declined.', + 'declined_if' => 'The :attribute field must be declined when :other is :value.', + 'different' => 'The :attribute field and :other must be different.', + 'digits' => 'The :attribute field must be :digits digits.', + 'digits_between' => 'The :attribute field must be between :min and :max digits.', + 'dimensions' => 'The :attribute field has invalid image dimensions.', + 'distinct' => 'The :attribute field has a duplicate value.', + 'doesnt_end_with' => 'The :attribute field must not end with one of the following: :values.', + 'doesnt_start_with' => 'The :attribute field must not start with one of the following: :values.', + 'email' => 'The :attribute field must be a valid email address.', + 'ends_with' => 'The :attribute field must end with one of the following: :values.', + 'enum' => 'The selected :attribute is invalid.', + 'exists' => 'The selected :attribute is invalid.', + 'extensions' => 'The :attribute field must have one of the following extensions: :values.', + 'file' => 'The :attribute field must be a file.', + 'filled' => 'The :attribute field must have a value.', + 'gt' => [ + 'array' => 'The :attribute field must have more than :value items.', + 'file' => 'The :attribute field must be greater than :value kilobytes.', + 'numeric' => 'The :attribute field must be greater than :value.', + 'string' => 'The :attribute field must be greater than :value characters.', + ], + 'gte' => [ + 'array' => 'The :attribute field must have :value items or more.', + 'file' => 'The :attribute field must be greater than or equal to :value kilobytes.', + 'numeric' => 'The :attribute field must be greater than or equal to :value.', + 'string' => 'The :attribute field must be greater than or equal to :value characters.', + ], + 'hex_color' => 'The :attribute field must be a valid hexadecimal color.', + 'image' => 'The :attribute field must be an image.', + 'in' => 'The selected :attribute is invalid.', + 'in_array' => 'The :attribute field must exist in :other.', + 'integer' => 'The :attribute field must be an integer.', + 'ip' => 'The :attribute field must be a valid IP address.', + 'ipv4' => 'The :attribute field must be a valid IPv4 address.', + 'ipv6' => 'The :attribute field must be a valid IPv6 address.', + 'json' => 'The :attribute field must be a valid JSON string.', + 'lowercase' => 'The :attribute field must be lowercase.', + 'lt' => [ + 'array' => 'The :attribute field must have less than :value items.', + 'file' => 'The :attribute field must be less than :value kilobytes.', + 'numeric' => 'The :attribute field must be less than :value.', + 'string' => 'The :attribute field must be less than :value characters.', + ], + 'lte' => [ + 'array' => 'The :attribute field must not have more than :value items.', + 'file' => 'The :attribute field must be less than or equal to :value kilobytes.', + 'numeric' => 'The :attribute field must be less than or equal to :value.', + 'string' => 'The :attribute field must be less than or equal to :value characters.', + ], + 'mac_address' => 'The :attribute field must be a valid MAC address.', + 'max' => [ + 'array' => 'The :attribute field must not have more than :max items.', + 'file' => 'The :attribute field must not be greater than :max kilobytes.', + 'numeric' => 'The :attribute field must not be greater than :max.', + 'string' => 'The :attribute field must not be greater than :max characters.', + ], + 'max_digits' => 'The :attribute field must not have more than :max digits.', + 'mimes' => 'The :attribute field must be a file of type: :values.', + 'mimetypes' => 'The :attribute field must be a file of type: :values.', + 'min' => [ + 'array' => 'The :attribute field must have at least :min items.', + 'file' => 'The :attribute field must be at least :min kilobytes.', + 'numeric' => 'The :attribute field must be at least :min.', + 'string' => 'The :attribute field must be at least :min characters.', + ], + 'min_digits' => 'The :attribute field must have at least :min digits.', + 'missing' => 'The :attribute field must be missing.', + 'missing_if' => 'The :attribute field must be missing when :other is :value.', + 'missing_unless' => 'The :attribute field must be missing unless :other is :value.', + 'missing_with' => 'The :attribute field must be missing when :values is present.', + 'missing_with_all' => 'The :attribute field must be missing when :values are present.', + 'multiple_of' => 'The :attribute field must be a multiple of :value.', + 'not_in' => 'The selected :attribute is invalid.', + 'not_regex' => 'The :attribute field format is invalid.', + 'numeric' => 'The :attribute field must be a number.', + 'password' => [ + 'letters' => 'The :attribute field must contain at least one letter.', + 'mixed' => 'The :attribute field must contain at least one uppercase and one lowercase letter.', + 'numbers' => 'The :attribute field must contain at least one number.', + 'symbols' => 'The :attribute field must contain at least one symbol.', + 'uncompromised' => 'The given :attribute has appeared in a data leak. Please choose a different :attribute.', + ], + 'present' => 'The :attribute field must be present.', + 'present_if' => 'The :attribute field must be present when :other is :value.', + 'present_unless' => 'The :attribute field must be present unless :other is :value.', + 'present_with' => 'The :attribute field must be present when :values is present.', + 'present_with_all' => 'The :attribute field must be present when :values are present.', + 'prohibited' => 'The :attribute field is prohibited.', + 'prohibited_if' => 'The :attribute field is prohibited when :other is :value.', + 'prohibited_unless' => 'The :attribute field is prohibited unless :other is in :values.', + 'prohibits' => 'The :attribute field prohibits :other from being present.', + 'regex' => 'The :attribute field format is invalid.', + 'required' => 'The :attribute field is required.', + 'required_array_keys' => 'The :attribute field must contain entries for: :values.', + 'required_if' => 'The :attribute field is required when :other is :value.', + 'required_if_accepted' => 'The :attribute field is required when :other is accepted.', + 'required_unless' => 'The :attribute field is required unless :other is in :values.', + 'required_with' => 'The :attribute field is required when :values is present.', + 'required_with_all' => 'The :attribute field is required when :values are present.', + 'required_without' => 'The :attribute field is required when :values is not present.', + 'required_without_all' => 'The :attribute field is required when none of :values are present.', + 'same' => 'The :attribute field must match :other.', + 'size' => [ + 'array' => 'The :attribute field must contain :size items.', + 'file' => 'The :attribute field must be :size kilobytes.', + 'numeric' => 'The :attribute field must be :size.', + 'string' => 'The :attribute field must be :size characters.', + ], + 'starts_with' => 'The :attribute field must start with one of the following: :values.', + 'string' => 'The :attribute field must be a string.', + 'timezone' => 'The :attribute field must be a valid timezone.', + 'unique' => 'The :attribute has already been taken.', + 'uploaded' => 'The :attribute failed to upload.', + 'uppercase' => 'The :attribute field must be uppercase.', + 'url' => 'The :attribute field must be a valid URL.', + 'ulid' => 'The :attribute field must be a valid ULID.', + 'uuid' => 'The :attribute field must be a valid UUID.', + + /* + |-------------------------------------------------------------------------- + | Custom Validation Language Lines + |-------------------------------------------------------------------------- + | + | Here you may specify custom validation messages for attributes using the + | convention "attribute.rule" to name the lines. This makes it quick to + | specify a specific custom language line for a given attribute rule. + | + */ + + 'custom' => [ + 'attribute-name' => [ + 'rule-name' => 'custom-message', + ], + ], + + /* + |-------------------------------------------------------------------------- + | Custom Validation Attributes + |-------------------------------------------------------------------------- + | + | The following language lines are used to swap our attribute placeholder + | with something more reader friendly such as "E-Mail Address" instead + | of "email". This simply helps us make our message more expressive. + | + */ + + 'attributes' => [ + 'password' => 'password', + 'Password' => 'password', + ], +]; diff --git a/lang/ru/requests.php b/lang/ru/requests.php new file mode 100644 index 0000000..247da1c --- /dev/null +++ b/lang/ru/requests.php @@ -0,0 +1,5 @@ + 'Поле :attribute обязательно.', +]; diff --git a/lang/ru/tooltips.php b/lang/ru/tooltips.php new file mode 100644 index 0000000..dd4b0bf --- /dev/null +++ b/lang/ru/tooltips.php @@ -0,0 +1,5 @@ + '1', +]; diff --git a/lang/ru/validation.php b/lang/ru/validation.php new file mode 100644 index 0000000..1769115 --- /dev/null +++ b/lang/ru/validation.php @@ -0,0 +1,193 @@ + ':attribute должен быть принят.', + 'accepted_if' => ':attribute должен быть принят, если :other равно :value.', + 'active_url' => ':attribute не является допустимым URL.', + 'after' => ':attribute должен быть датой после :date.', + 'after_or_equal' => ':attribute должен быть датой после :date или равным ей.', + 'alpha' => ':attribute должен содержать только буквы.', + 'alpha_dash' => ':attribute должен содержать только буквы, цифры, дефисы и символы подчеркивания.', + 'alpha_num' => ':attribute должен содержать только буквы и цифры.', + 'array' => ':attribute должен быть массивом.', + 'ascii' => 'Поле :attribute должно содержать только однобайтные буквенно-цифровые символы и символы.', + 'before' => ':attribute должен быть датой до :date.', + 'before_or_equal' => ':attribute должен быть датой, предшествующей :date или равной ей.', + 'between' => [ + 'array' => ':attribute должен содержать от :min до :max элементов.', + 'file' => ':attribute должен быть между :min и :max килобайтами.', + 'numeric' => ':attribute должен быть между :min и :max.', + 'string' => ':attribute должен быть между символами :min и :max.', + ], + 'boolean' => 'Поле :attribute должно быть истинным или ложным.', + 'can' => 'Поле :attribute содержит неавторизованное значение.', + 'confirmed' => ':attribute и подтверждение не совпадают', + 'current_password' => 'Неверный пароль.', + 'date' => ':attribute не является действительной датой.', + 'date_equals' => ':attribute должен быть датой, равной :date.', + 'date_format' => ':attribute не соответствует формату :format.', + 'decimal' => 'Поле :attribute должно иметь :decimal десятичные места.', + 'declined' => ':attribute должен быть отклонен.', + 'declined_if' => ':attribute должен быть отклонен, если :other равно :value.', + 'different' => ':attribute и :other должны быть разными.', + 'digits' => 'The :attribute должен быть :digits digits.', + 'digits_between' => 'должен быть между цифрами :min и :max.', + 'dimensions' => 'The :attribute имеет недопустимые размеры изображения.', + 'distinct' => 'The :attribute имеет повторяющееся значение.', + 'doesnt_end_with' => 'The :attribute не может заканчиваться одним из следующих: :values.', + 'doesnt_start_with' => 'The :attribute не может начинаться с одного из следующих: :values.', + 'email' => ':attribute должен быть действительным адресом электронной почты.', + 'ends_with' => 'The :attribute должен заканчиваться одним из следующих: :values.', + 'enum' => 'Выбранный :attribute недействителен.', + 'exists' => 'Выбранный :attribute недействителен.', + 'extensions' => 'Поле :attribute должно иметь одно из следующих расширений :values.', + 'file' => ':attribute должен быть файлом.', + 'filled' => 'Поле :attribute должно иметь значение.', + 'gt' => [ + 'array' => ':attribute должен содержать больше элементов, чем :value.', + 'file' => ':attribute должен быть больше :value килобайт.', + 'numeric' => ':attribute должен быть больше :value.', + 'string' => ':attribute должен быть больше символов :value.', + ], + 'gte' => [ + 'array' => ':attribute должен содержать элементы :value или более.', + 'file' => ':attribute должен быть больше или равен :value килобайтам.', + 'numeric' => ':attribute должен быть больше или равен :value.', + 'string' => ':attribute должен быть больше или равен символам :value.', + ], + 'hex_color' => 'Поле :attribute должно иметь допустимый шестнадцатеричный цвет.', + 'image' => ':attribute должен быть изображением.', + 'in' => 'Выбранный :attribute недействителен.', + 'in_array' => 'Поле :attribute не существует в :other.', + 'integer' => ':attribute должен быть целым числом.', + 'ip' => ':attribute должен быть действительным IP-адресом.', + 'ipv4' => ':attribute должен быть действительным адресом IPv4.', + 'ipv6' => ':attribute должен быть действительным адресом IPv6.', + 'json' => ':attribute должен быть допустимой строкой JSON.', + 'lowercase' => 'Поле :attribute должно быть в нижнем регистре.', + 'lt' => [ + 'array' => ':attribute должен содержать элементов меньше :value.', + 'file' => ':attribute должен быть меньше :value килобайт.', + 'numeric' => ':attribute должен быть меньше :value.', + 'string' => ':attribute должен быть меньше символов :value.', + ], + 'lte' => [ + 'array' => ':attribute не должен содержать больше элементов, чем :value.', + 'file' => 'The :attribute должен быть меньше или равен :value килобайтам.', + 'numeric' => 'The :attribute должен быть меньше или равен :value.', + 'string' => 'The :attribute должен быть меньше или равен символам :value.', + ], + 'mac_address' => ':attribute должен быть действительным MAC-адресом.', + 'max' => [ + 'array' => ':attribute должен содержать не более :max элементов.', + 'file' => ':attribute не должен превышать :max килобайт.', + 'numeric' => ':attribute не должен быть больше :max.', + 'string' => ':attribute не должен превышать :max символов.', + ], + 'max_digits' => ':attribute не должен содержать более :max цифр.', + 'mimes' => ':attribute должен быть файлом типа: :values.', + 'mimetypes' => ':attribute должен быть файлом типа: :values.', + 'min' => [ + 'array' => ':attribute должен содержать не менее :min элементов.', + 'file' => ':attribute должен быть не менее :min килобайт.', + 'numeric' => ':attribute должен быть не меньше :min.', + 'string' => ':attribute должен иметь длину не менее :min символов.', + ], + 'min_digits' => ':attribute должен содержать не менее :min цифр.', + 'missing' => 'Поле :attribute должно отсутствовать.', + 'missing_if' => 'Поле :attribute должно отсутствовать, если :other является :value.', + 'missing_unless' => 'Поле :attribute должно отсутствовать, если :other не является :value.', + 'missing_with' => 'При наличии :values :attribute должно отсутствовать.', + 'missing_with_all' => 'Поле :attribute должно отсутствовать при наличии :values.', + 'multiple_of' => ':attribute должен быть кратен :value.', + 'not_in' => 'Выбранный :attribute недействителен.', + 'not_regex' => 'Неверный формат :attribute.', + 'numeric' => ':attribute должен быть числом.', + 'password' => [ + 'letters' => ':attribute должен содержать хотя бы одну букву.', + 'mixed' => ':attribute должен содержать как минимум одну прописную и одну строчную букву.', + 'numbers' => ':attribute должен содержать хотя бы одно число.', + 'symbols' => ':attribute должен содержать хотя бы один символ.', + 'uncompromised' => 'Данный :attribute появился в утечке данных. Пожалуйста, выберите другой :attribute.', + ], + 'present' => 'Поле :attribute должно присутствовать.', + 'present_if' => 'Поле :attribute должно присутствовать, когда :other является :value.', + 'present_unless' => 'The :attribute field must be present unless :other is :value.', + 'present_with' => 'Поле :attribute должно присутствовать, если :other не является :value.', + 'present_with_all' => 'Поле :attribute должно присутствовать, когда присутствуют :values.', + 'prohibited' => 'Поле :attribute запрещено.', + 'prohibited_if' => 'Поле :attribute запрещено, если :other равно :value.', + 'prohibited_unless' => 'Поле :attribute запрещено, если :other не находится в :values.', + 'prohibits' => 'Поле :attribute запрещает присутствие :other.', + 'regex' => 'Неверный формат :attribute.', + 'required' => 'Поле :attribute обязательно.', + 'required_array_keys' => 'Поле :attribute должно содержать записи для: :values.', + 'required_if' => 'Поле :attribute обязательно, если :other равно :value.', + 'required_if_accepted' => 'Поле :attribute обязательно, когда принимается :other.', + 'required_unless' => 'Поле :attribute является обязательным, если только :other не находится в :values.', + 'required_with' => 'Поле :attribute обязательно, если присутствует :values.', + 'required_with_all' => 'Поле :attribute обязательно, если присутствуют :values.', + 'required_without' => 'Поле :attribute является обязательным, если :values отсутствует.', + 'required_without_all' => 'Поле :attribute является обязательным, если ни одно из :value не присутствует.', + 'same' => ':attribute и :other должны совпадать.', + 'size' => [ + 'array' => ':attribute должен содержать элементы :size.', + 'file' => ':attribute должен быть :size килобайт.', + 'numeric' => ':attribute должен быть :size.', + 'string' => ':attribute должен быть размером :size символов.', + ], + 'starts_with' => ':attribute должен начинаться с одного из следующих: :values.', + 'string' => ':attribute должен быть строкой.', + 'timezone' => ':attribute должен быть действительным часовым поясом.', + 'unique' => ':attribute уже занят.', + 'uploaded' => 'Не удалось загрузить :attribute.', + 'uppercase' => 'Поле :attribute должно быть в верхнем реистре', + 'url' => ':attribute должен быть допустимым URL.', + 'ulid' => 'Поле :attribute должно быть допустимым ULID.', + 'uuid' => ':attribute должен быть действительным UUID.', + + /* + |-------------------------------------------------------------------------- + | Custom Validation Language Lines + |-------------------------------------------------------------------------- + | + | Here you may specify custom validation messages for attributes using the + | convention "attribute.rule" to name the lines. This makes it quick to + | specify a specific custom language line for a given attribute rule. + | + */ + + 'custom' => [ + 'attribute-name' => [ + 'rule-name' => 'custom-message', + ], + ], + + /* + |-------------------------------------------------------------------------- + | Custom Validation Attributes + |-------------------------------------------------------------------------- + | + | The following language lines are used to swap our attribute placeholder + | with something more reader friendly such as "E-Mail Address" instead + | of "email". This simply helps us make our message more expressive. + | + */ + + 'attributes' => [ + 'password' => 'Пароль', + 'Password' => 'Пароль', + ], +]; diff --git a/resources/js/app.js b/resources/js/app.js index b340e13..5bae56d 100644 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -1,4 +1,4 @@ -// import './bootstrap'; +import './bootstrap'; import Alpine from 'alpinejs'; import ujs from '@rails/ujs'; diff --git a/resources/views/admin/catalog/faculty/create.blade.php b/resources/views/admin/catalog/faculty/create.blade.php index a843176..ca60d06 100644 --- a/resources/views/admin/catalog/faculty/create.blade.php +++ b/resources/views/admin/catalog/faculty/create.blade.php @@ -1,3 +1,4 @@ +@php use App\Helpers\PositionHelper; @endphp @extends('layouts.admin_layout') @section('content') @auth() @@ -7,12 +8,13 @@ {{ Form::open(['url' => route('faculties.store'), 'method' => 'POST', 'class' => '']) }}
- {{ Form::label('position', 'Позиция') }} + {{ Form::label('position', 'Позиция', ['data-bs-toggle' => "tooltip", 'data-bs-title' => __('tooltips.position')]) }} + *
- {{ Form::text('position', '', ['class' => 'form-control']) }} + {{ Form::number('position', PositionHelper::faculty(), ['class' => 'form-control', 'data-bs-toggle' => "tooltip", 'data-bs-title' => __('tooltips.position')]) }}
-
+
@if ($errors->any()) {{ $errors->first('position') }} @endif @@ -20,11 +22,12 @@
{{ Form::label('name', 'Название') }} + *
{{ Form::text('name', '', ['class' => 'form-control']) }}
-
+
@if ($errors->any()) {{ $errors->first('name') }} @endif @@ -36,18 +39,19 @@
{{ Form::text('description', '', ['class' => 'form-control']) }}
-
+
@if ($errors->any()) {{ $errors->first('description') }} @endif
{{ Form::label('educational_institution_id', 'Учебное заведение') }} + *
{{ Form::select('educational_institution_id', $educationalInstitutions, null, ['class' => 'form-select']) }}
-
+
@if ($errors->any()) {{ $errors->first('educational_institution_id') }} @endif @@ -58,7 +62,7 @@
{{ Form::text('slug', '', ['class' => 'form-control']) }}
-
+
@if ($errors->any()) {{ $errors->first('slug') }} @endif diff --git a/resources/views/layouts/admin_layout.blade.php b/resources/views/layouts/admin_layout.blade.php index f8fa2fd..01317b2 100644 --- a/resources/views/layouts/admin_layout.blade.php +++ b/resources/views/layouts/admin_layout.blade.php @@ -11,6 +11,7 @@ +@include('layouts.tooltips')
diff --git a/resources/views/layouts/tooltips.blade.php b/resources/views/layouts/tooltips.blade.php new file mode 100644 index 0000000..e5e90c4 --- /dev/null +++ b/resources/views/layouts/tooltips.blade.php @@ -0,0 +1,4 @@ +