From 58f213ae231f8d1d3980c50b316bf3e0c6dfd7de Mon Sep 17 00:00:00 2001 From: panabonic Date: Thu, 9 Nov 2023 11:13:17 +0300 Subject: [PATCH] few updates --- .../Api/Localization/LocalesController.php | 48 ++ app/Http/Kernel.php | 2 + app/Http/Middleware/CORS.php | 2 +- app/Http/Middleware/Localization.php | 16 + app/Models/Localization/Locale.php | 61 ++ app/Models/Pages/Page.php | 8 + app/Services/Forms/Pages/PageForms.php | 46 +- .../Localization/LocaleTransformer.php | 28 + app/Transformers/Pages/PageTransformer.php | 9 +- composer.json | 1 + composer.lock | 654 +++++++++++++++++- config/app.php | 4 +- .../2023_05_29_183212_create_pages_table.php | 3 + ...2023_11_05_224607_create_locales_table.php | 38 + database/seeders/DatabaseSeeder.php | 2 + .../Localization/LocalesTableSeeder.php | 21 + resources/lang/ru.json | 51 ++ resources/lang/ru/auth.php | 17 +- resources/lang/ru/http-statuses.php | 76 ++ resources/lang/ru/pagination.php | 15 +- resources/lang/ru/passwords.php | 23 +- resources/lang/ru/validation.php | 317 +++++---- routes/api.php | 9 + 23 files changed, 1264 insertions(+), 187 deletions(-) create mode 100644 app/Http/Controllers/Api/Localization/LocalesController.php create mode 100644 app/Http/Middleware/Localization.php create mode 100644 app/Models/Localization/Locale.php create mode 100644 app/Transformers/Localization/LocaleTransformer.php create mode 100644 database/migrations/2023_11_05_224607_create_locales_table.php create mode 100644 database/seeders/Localization/LocalesTableSeeder.php create mode 100644 resources/lang/ru.json create mode 100644 resources/lang/ru/http-statuses.php diff --git a/app/Http/Controllers/Api/Localization/LocalesController.php b/app/Http/Controllers/Api/Localization/LocalesController.php new file mode 100644 index 0000000..26c6fa4 --- /dev/null +++ b/app/Http/Controllers/Api/Localization/LocalesController.php @@ -0,0 +1,48 @@ +model = $model; + } + + public function index(Request $request): JsonResponse { + $query = $this->model->query(); + $paginator = $query->paginate(config('app.pagination_limit')); + return fractal($paginator, new LocaleTransformer())->respond(); + } + + public function show(Request $request, $id): JsonResponse { + $model = $this->model->byUuid($id)->firstOrFail(); + return fractal($model, new LocaleTransformer())->respond(); + } + + + public function menu(Request $request): JsonResponse { + return fractal($this->model->query()->enabled()->get(), new LocaleTransformer())->respond(); + } + + + public function store(Request $request): void { + } + + + public function update(Request $request, $uuid): void { + } + + public function destroy(Request $request, $uuid): JsonResponse { + $model = $this->model->byUuid($uuid)->firstOrFail(); + $model->delete(); + return response()->json(null, 204); + } + +} diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index ac26ee1..e242809 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -2,6 +2,7 @@ namespace App\Http; +use App\Http\Middleware\Localization; use Illuminate\Foundation\Http\Kernel as HttpKernel; class Kernel extends HttpKernel @@ -42,6 +43,7 @@ class Kernel extends HttpKernel 'api' => [ 'throttle:api', + Localization::class, \Illuminate\Routing\Middleware\SubstituteBindings::class, \TomLerendu\LaravelConvertCaseMiddleware\ConvertRequestToSnakeCase::class, \TomLerendu\LaravelConvertCaseMiddleware\ConvertResponseToCamelCase::class, diff --git a/app/Http/Middleware/CORS.php b/app/Http/Middleware/CORS.php index 129b529..5211898 100644 --- a/app/Http/Middleware/CORS.php +++ b/app/Http/Middleware/CORS.php @@ -21,7 +21,7 @@ class CORS $response->headers->set("Access-Control-Allow-Origin", "*"); $response->headers->set("Access-Control-Allow-Credentials", "true"); $response->headers->set("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE, PUT, PATCH"); //Make sure you remove those you do not want to support - $response->headers->set("Access-Control-Allow-Headers", "Content-Type, Accept, Authorization, X-Requested-With, Application"); + $response->headers->set("Access-Control-Allow-Headers", "Content-Type, Accept, Authorization, X-Requested-With, Application, Locale"); return $response; } diff --git a/app/Http/Middleware/Localization.php b/app/Http/Middleware/Localization.php new file mode 100644 index 0000000..ddc9458 --- /dev/null +++ b/app/Http/Middleware/Localization.php @@ -0,0 +1,16 @@ +header('Locale')) { + App::setLocale($locale); + Carbon::setLocale($locale); + } + return $next($request); + } +} \ No newline at end of file diff --git a/app/Models/Localization/Locale.php b/app/Models/Localization/Locale.php new file mode 100644 index 0000000..c6ae03f --- /dev/null +++ b/app/Models/Localization/Locale.php @@ -0,0 +1,61 @@ +where(['is_enabled' => true]); + } + + + public function getIsActiveAttribute(): bool { + return $this->name === App::getLocale(); + } + + + public function toggle(): bool { + return $this->is_enabled ? $this->disable() : $this->enable(); + } + public function enable(): bool { + return $this->update(['is_enabled' => true]); + } + public function disable(): bool { + return $this->update(['is_enabled' => false]); + } + + + public function setAsDefault(): bool { + self::query()->where(['is_default' => true])->update(['is_default' => false]); + return $this->update(['is_default' => true]); + } + + public static function default() { + return self::query()->where(['is_default' => 1])->first(); + } + +} diff --git a/app/Models/Pages/Page.php b/app/Models/Pages/Page.php index 4fd95a3..045cbcc 100644 --- a/app/Models/Pages/Page.php +++ b/app/Models/Pages/Page.php @@ -2,6 +2,7 @@ namespace App\Models\Pages; +use App\Models\Asset; use App\Models\Objects\Field; use App\Models\Publications\Publication; use App\Models\Registries\Registry; @@ -25,11 +26,14 @@ class Page extends Model { protected $fillable = [ 'uuid', 'parent_id', + 'picture_id', 'slug', 'type', 'sub_type', 'name', 'title', + 'description', + 'keywords', 'h1', 'ord' ]; @@ -51,6 +55,10 @@ class Page extends Model { return $this->hasMany(Page::class, 'parent_id', 'parent_id'); } + public function picture(): BelongsTo { + return $this->belongsTo(Asset::class); + } + public function sections(): MorphToMany { return $this->objects()->wherePivot('group', '=', 'sections'); } diff --git a/app/Services/Forms/Pages/PageForms.php b/app/Services/Forms/Pages/PageForms.php index dfdc6fe..2f3afe2 100644 --- a/app/Services/Forms/Pages/PageForms.php +++ b/app/Services/Forms/Pages/PageForms.php @@ -2,12 +2,14 @@ namespace App\Services\Forms\Pages; +use App\Models\Asset; use App\Models\Objects\FieldType; use App\Models\Pages\Page; use App\Models\Pages\PageSubType; use App\Models\Pages\PageType; use App\Models\Registries\RegistryType; use App\Services\Forms\FormsService; +use App\Transformers\Assets\AssetTransformer; use App\Transformers\Pages\PageTransformer; use Illuminate\Http\JsonResponse; use Illuminate\Support\Str; @@ -19,13 +21,16 @@ class PageForms extends FormsService { $model = Page::byUuid($id)->first(); $groups = [ [ - 'name' => 'common', 'fields' => $this->commonGroupFields($model), + 'name' => 'common', 'title' => 'Основные свойства страницы', 'fields' => $this->commonGroupFields($model), 'dynamic' => [ ['field' => 'type', 'hide' => ['registry_type', 'subtype']], ['field' => 'type', 'value' => PageType::REGISTRY, 'show' => ['registry_type']], ['field' => 'type', 'value' => PageType::PUBLICATIONS, 'show' => ['subtype']] ] + ], + [ + 'name' => 'seo', 'title' => 'Мета данные', 'fields' => $this->seoGroupFields($model) ] ]; return ['title' => $this->formTitle($model), 'data' => $groups]; @@ -70,16 +75,54 @@ class PageForms extends FormsService { 'required' => true, 'options' => $this->getRelationItems(PageSubType::TITLES), 'value' => $this->getRelationValue(PageSubType::TITLES, $model->sub_type ?? null) + ], + [ + 'name' => 'picture', + 'title' => 'Изображение', + 'type' => FieldType::IMAGE, + 'value' => ($v = $model->picture ?? null) ? fractal($v, new AssetTransformer()) : null ] ]; return ['data' => $fields]; } + public function seoGroupFields(?Page $model): array { + $fields = [ + [ + 'name' => 'h1', + 'title' => 'Заголовок H1', + 'type' => FieldType::STRING, + 'value' => $model->keywords ?? null + ], + [ + 'name' => 'title', + 'title' => 'Title страницы', + 'type' => FieldType::STRING, + 'value' => $model->title ?? null + ], + [ + 'name' => 'description', + 'title' => 'Описание', + 'type' => FieldType::TEXT, + 'value' => $model->description ?? null + ], + [ + 'name' => 'keywords', + 'title' => 'Ключевые слова', + 'type' => FieldType::STRING, + 'value' => $model->keywords ?? null + ], + + ]; + return ['data' => $fields]; + } + public function store(array $data): ?JsonResponse { $parent = Page::byUuid($data['parent'] ?? null)->first(); $data['parent_id'] = $parent->id ?? 0; + $data['picture_id'] = ($v = Asset::byUuid($data['picture'] ?? null)->first()) ? $v->id : null; $data['slug'] = $data['slug'] ?? Str::slug(Str::transliterate($data['name'] ?? null)); $model = Page::create($data); $model->update(['ord' => $model->getMaxOrd()]); @@ -89,6 +132,7 @@ class PageForms extends FormsService { public function update(string $id, array $data): ?JsonResponse { $model = Page::byUuid($id)->firstOrFail(); + $data['picture_id'] = ($v = Asset::byUuid($data['picture'] ?? null)->first()) ? $v->id : null; $data['slug'] = $data['slug'] ?? Str::slug(Str::transliterate($data['name'] ?? null)); $model->update($data); if ($model->type === PageType::REGISTRY) $model->registry->update(['type' => $data['registry_type'] ?? RegistryType::SIMPLE]); diff --git a/app/Transformers/Localization/LocaleTransformer.php b/app/Transformers/Localization/LocaleTransformer.php new file mode 100644 index 0000000..8f9e90c --- /dev/null +++ b/app/Transformers/Localization/LocaleTransformer.php @@ -0,0 +1,28 @@ + $model->uuid, + 'name' => $model->name, + 'name_iso' => $model->name_iso, + 'title' => $model->title, + 'is_active' => $model->isActive, + 'is_enabled' => boolval($model->is_enabled), + 'is_default' => boolval($model->is_default) + ]; + } + + +} diff --git a/app/Transformers/Pages/PageTransformer.php b/app/Transformers/Pages/PageTransformer.php index 551e53a..05d6ce9 100644 --- a/app/Transformers/Pages/PageTransformer.php +++ b/app/Transformers/Pages/PageTransformer.php @@ -4,6 +4,7 @@ namespace App\Transformers\Pages; use App\Models\Pages\Page; use App\Services\PermissionsService; +use App\Transformers\Assets\AssetTransformer; use App\Transformers\Objects\ObjectTransformer; use App\Transformers\Publications\PublicationTransformer; use App\Transformers\Registries\RegistryTransformer; @@ -18,7 +19,7 @@ class PageTransformer extends TransformerAbstract { ]; protected array $availableIncludes = [ - 'children', 'parent', 'parents', 'sections', 'sidebars', 'publications', + 'children', 'parent', 'parents', 'picture', 'sections', 'sidebars', 'publications', 'registries', 'registry', 'permissions' ]; @@ -31,6 +32,8 @@ class PageTransformer extends TransformerAbstract { 'sub_type' => $model->sub_type, 'name' => $model->name, 'title' => $model->title, + 'description' => $model->description, + 'keywords' => $model->keywords, 'h1' => $model->h1, 'created_at' => $model->created_at ? $model->created_at->toIso8601String() : null, 'updated_at' => $model->updated_at ? $model->updated_at->toIso8601String() : null @@ -49,6 +52,10 @@ class PageTransformer extends TransformerAbstract { return $this->collection($model->parents->reverse(), new PageTransformer()); } + public function includePicture(Page $model): ?Item { + return $model->picture ? $this->item($model->picture, new AssetTransformer()) : null; + } + public function includeSections(Page $model): Collection { return $this->collection($model->sections, new ObjectTransformer()); } diff --git a/composer.json b/composer.json index 525aadc..0f0a0e5 100644 --- a/composer.json +++ b/composer.json @@ -27,6 +27,7 @@ "guzzlehttp/guzzle": "^7.0.1", "intervention/image": "^2.5", "intervention/imagecache": "^2.4", + "laravel-lang/common": "^1.0", "laravel/framework": "^8.0", "laravel/passport": "^10.0", "laravel/socialite": "^5.1", diff --git a/composer.lock b/composer.lock index 6b0d553..67e8f16 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": "19a46ca556224368f88f689f8cc0ffb1", + "content-hash": "5b498713aa3e96e8f7771993a3011a4a", "packages": [ { "name": "asm89/stack-cors", @@ -647,6 +647,252 @@ }, "time": "2022-04-27T13:50:54+00:00" }, + { + "name": "dragon-code/contracts", + "version": "v2.19.1", + "source": { + "type": "git", + "url": "https://github.com/TheDragonCode/contracts.git", + "reference": "644ac91d9df96ebec3a46c0d2cc8ff51a83cbfad" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/TheDragonCode/contracts/zipball/644ac91d9df96ebec3a46c0d2cc8ff51a83cbfad", + "reference": "644ac91d9df96ebec3a46c0d2cc8ff51a83cbfad", + "shasum": "" + }, + "require": { + "php": "^7.2.5 || ^8.0", + "psr/http-message": "^1.0.1 || ^2.0", + "symfony/http-kernel": "^4.0 || ^5.0 || ^6.0", + "symfony/polyfill-php80": "^1.23" + }, + "conflict": { + "andrey-helldar/contracts": "*" + }, + "require-dev": { + "illuminate/database": "^10.0", + "phpdocumentor/reflection-docblock": "^5.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "DragonCode\\Contracts\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Andrey Helldar", + "email": "helldar@dragon-code.pro", + "homepage": "https://github.com/andrey-helldar" + } + ], + "description": "A set of contracts for any project", + "keywords": [ + "contracts", + "interfaces" + ], + "support": { + "source": "https://github.com/TheDragonCode/contracts" + }, + "funding": [ + { + "url": "https://boosty.to/dragon-code", + "type": "boosty" + }, + { + "url": "https://github.com/sponsors/TheDragonCode", + "type": "github" + }, + { + "url": "https://opencollective.com/dragon-code", + "type": "open_collective" + }, + { + "url": "https://yoomoney.ru/to/410012608840929", + "type": "yoomoney" + } + ], + "time": "2023-04-19T08:23:59+00:00" + }, + { + "name": "dragon-code/pretty-array", + "version": "v3.0.0", + "source": { + "type": "git", + "url": "https://github.com/TheDragonCode/pretty-array.git", + "reference": "bc6629eb266e7869d540dd1fcf13e8c7e1c61e82" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/TheDragonCode/pretty-array/zipball/bc6629eb266e7869d540dd1fcf13e8c7e1c61e82", + "reference": "bc6629eb266e7869d540dd1fcf13e8c7e1c61e82", + "shasum": "" + }, + "require": { + "dragon-code/contracts": "^2.6", + "dragon-code/support": "^5.0", + "ext-dom": "*", + "ext-mbstring": "*", + "php": "^7.3|^8.0" + }, + "conflict": { + "andrey-helldar/pretty-array": "*" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "suggest": { + "symfony/thanks": "Give thanks (in the form of a GitHub) to your fellow PHP package maintainers" + }, + "type": "library", + "autoload": { + "psr-4": { + "DragonCode\\PrettyArray\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Andrey Helldar", + "email": "helldar@ai-rus.com" + } + ], + "description": "Simple conversion of an array to a pretty view", + "keywords": [ + "andrey helldar", + "array", + "dragon", + "dragon code", + "pretty", + "pretty array" + ], + "support": { + "issues": "https://github.com/TheDragonCode/pretty-array/issues", + "source": "https://github.com/TheDragonCode/pretty-array" + }, + "funding": [ + { + "url": "https://paypal.me/helldar", + "type": "custom" + }, + { + "url": "https://yoomoney.ru/to/410012608840929", + "type": "custom" + }, + { + "url": "https://opencollective.com/dragon-code", + "type": "open_collective" + }, + { + "url": "https://www.patreon.com/andrey_helldar", + "type": "patreon" + } + ], + "time": "2021-11-16T17:50:22+00:00" + }, + { + "name": "dragon-code/support", + "version": "v5.8.1", + "source": { + "type": "git", + "url": "https://github.com/TheDragonCode/support.git", + "reference": "27af9d8f9ebb0c672ed76d516f524d8d58346cab" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/TheDragonCode/support/zipball/27af9d8f9ebb0c672ed76d516f524d8d58346cab", + "reference": "27af9d8f9ebb0c672ed76d516f524d8d58346cab", + "shasum": "" + }, + "require": { + "dragon-code/contracts": "^2.15", + "ext-ctype": "*", + "ext-dom": "*", + "ext-json": "*", + "ext-mbstring": "*", + "php": "^7.2.5 || ^8.0", + "psr/http-message": "^1.0.1", + "symfony/deprecation-contracts": "^2.5 || ^3.0", + "voku/portable-ascii": "^1.4.8|^2.0" + }, + "conflict": { + "andrey-helldar/support": "*" + }, + "require-dev": { + "ext-bcmath": "*", + "phpunit/phpunit": "^8.0 || ^9.0", + "symfony/var-dumper": "^5.2 || ^6.0" + }, + "suggest": { + "dragon-code/laravel-support": "Various helper files for the Laravel and Lumen frameworks", + "ext-bcmath": "Require the extension if you will be using DragonCode\\Support\\Facades\\Helpers\\Digit.", + "symfony/thanks": "Give thanks (in the form of a GitHub) to your fellow PHP package maintainers" + }, + "type": "library", + "autoload": { + "psr-4": { + "DragonCode\\Support\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Andrey Helldar", + "email": "helldar@ai-rus.com" + } + ], + "description": "Support package is a collection of helpers and tools for any project.", + "keywords": [ + "dragon", + "dragon-code", + "framework", + "helper", + "helpers", + "laravel", + "support", + "symfony", + "yii", + "yii2" + ], + "support": { + "issues": "https://github.com/TheDragonCode/support/issues", + "source": "https://github.com/TheDragonCode/support" + }, + "funding": [ + { + "url": "https://paypal.me/helldar", + "type": "custom" + }, + { + "url": "https://yoomoney.ru/to/410012608840929", + "type": "custom" + }, + { + "url": "https://github.com/TheDragonCode", + "type": "github" + }, + { + "url": "https://opencollective.com/dragon-code", + "type": "open_collective" + }, + { + "url": "https://www.patreon.com/andrey_helldar", + "type": "patreon" + } + ], + "time": "2022-04-01T17:14:16+00:00" + }, { "name": "dragonmantank/cron-expression", "version": "v3.3.3", @@ -1627,6 +1873,412 @@ ], "time": "2022-10-10T10:11:09+00:00" }, + { + "name": "laravel-lang/attributes", + "version": "v1.1.3", + "source": { + "type": "git", + "url": "https://github.com/Laravel-Lang/attributes.git", + "reference": "2a6b4715b02fffeeb7954158f52f5e7c01cf8707" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Laravel-Lang/attributes/zipball/2a6b4715b02fffeeb7954158f52f5e7c01cf8707", + "reference": "2a6b4715b02fffeeb7954158f52f5e7c01cf8707", + "shasum": "" + }, + "require": { + "ext-json": "*", + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "dragon-code/pretty-array": "^4.0", + "dragon-code/support": "^6.0", + "laravel-lang/publisher": "^12.1 || ^13.0", + "orchestra/testbench": "^5.0 || ^6.0 || ^7.0", + "phpunit/phpunit": "^9.5", + "symfony/finder": "^5.0 || ^6.0", + "symfony/var-dumper": "^5.0 || ^6.0" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "LaravelLang\\Attributes\\ServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "LaravelLang\\Attributes\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Andrey Helldar", + "email": "helldar@ai-rus.com" + }, + { + "name": "Laravel-Lang Team", + "homepage": "https://github.com/Laravel-Lang" + } + ], + "description": "List of 78 languages for form field names", + "keywords": [ + "attributes", + "fields", + "form", + "lang", + "languages", + "laravel", + "messages", + "translations", + "validation" + ], + "support": { + "issues": "https://github.com/Laravel-Lang/attributes/issues", + "source": "https://github.com/Laravel-Lang/attributes/tree/v1.1.3" + }, + "funding": [ + { + "url": "https://opencollective.com/laravel-lang", + "type": "open_collective" + } + ], + "time": "2022-06-29T19:06:05+00:00" + }, + { + "name": "laravel-lang/common", + "version": "v1.0.1", + "source": { + "type": "git", + "url": "https://github.com/Laravel-Lang/common.git", + "reference": "2b08c50d33dd425c4e9035fe8a6714eb41c5aae1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Laravel-Lang/common/zipball/2b08c50d33dd425c4e9035fe8a6714eb41c5aae1", + "reference": "2b08c50d33dd425c4e9035fe8a6714eb41c5aae1", + "shasum": "" + }, + "require": { + "dragon-code/contracts": "2.19.1", + "illuminate/translation": "^7.0 || ^8.0 || ^9.0", + "laravel-lang/attributes": "^1.0", + "laravel-lang/http-statuses": "^2.0", + "laravel-lang/lang": "^10.0", + "laravel-lang/publisher": "^12.0", + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "orchestra/testbench": "^5.0 || ^6.0 || ^7.0", + "phpunit/phpunit": "^9.6", + "symfony/var-dumper": "^5.3 || ^6.0" + }, + "type": "library", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Laravel-Lang Team", + "homepage": "https://github.com/Laravel-Lang" + }, + { + "name": "Andrey Helldar", + "email": "helldar@dragon-code.pro", + "homepage": "https://github.com/andrey-helldar" + } + ], + "description": "Easily connect the necessary language packs to the application", + "keywords": [ + "Laravel-lang", + "attribute", + "attributes", + "http", + "http-statuses", + "i18n", + "lang", + "languages", + "laravel", + "locale", + "locales", + "publisher", + "statuses", + "translation", + "translations" + ], + "support": { + "issues": "https://github.com/Laravel-Lang/common/issues", + "source": "https://github.com/Laravel-Lang/common" + }, + "funding": [ + { + "url": "https://opencollective.com/laravel-lang", + "type": "open_collective" + } + ], + "time": "2023-09-09T10:07:42+00:00" + }, + { + "name": "laravel-lang/http-statuses", + "version": "v2.1.3", + "source": { + "type": "git", + "url": "https://github.com/Laravel-Lang/http-statuses.git", + "reference": "2de194362eda52125994150c635c440ce4eca9b4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Laravel-Lang/http-statuses/zipball/2de194362eda52125994150c635c440ce4eca9b4", + "reference": "2de194362eda52125994150c635c440ce4eca9b4", + "shasum": "" + }, + "require": { + "ext-json": "*", + "php": "^7.3 || ^8.0" + }, + "conflict": { + "laravel-lang/publisher": "<13.0 >=14.0" + }, + "require-dev": { + "laravel-lang/publisher": "^13.0", + "orchestra/testbench": "^5.0 || ^6.0 || ^7.0", + "phpunit/phpunit": "^9.5", + "symfony/var-dumper": "^5.0 || ^6.0" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "LaravelLang\\HttpStatuses\\ServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "LaravelLang\\HttpStatuses\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Andrey Helldar", + "email": "helldar@ai-rus.com" + }, + { + "name": "Laravel-Lang Team", + "homepage": "https://github.com/Laravel-Lang" + } + ], + "description": "List of 78 languages for HTTP statuses", + "keywords": [ + "http", + "lang", + "languages", + "laravel", + "messages", + "status", + "translations" + ], + "support": { + "issues": "https://github.com/Laravel-Lang/http-statuses/issues", + "source": "https://github.com/Laravel-Lang/http-statuses/tree/v2.1.3" + }, + "funding": [ + { + "url": "https://opencollective.com/laravel-lang", + "type": "open_collective" + } + ], + "time": "2022-06-28T18:02:34+00:00" + }, + { + "name": "laravel-lang/lang", + "version": "10.9.5", + "source": { + "type": "git", + "url": "https://github.com/Laravel-Lang/lang.git", + "reference": "e341421d40f2cd28feca24ab2cb84fa5cb5ddaf6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Laravel-Lang/lang/zipball/e341421d40f2cd28feca24ab2cb84fa5cb5ddaf6", + "reference": "e341421d40f2cd28feca24ab2cb84fa5cb5ddaf6", + "shasum": "" + }, + "require": { + "ext-json": "*" + }, + "conflict": { + "laravel-lang/publisher": "<12.0 >=14.0" + }, + "require-dev": { + "dragon-code/pretty-array": "^4.0", + "dragon-code/simple-dto": "^2.3", + "dragon-code/support": "^6.1", + "ext-zip": "*", + "guzzlehttp/guzzle": "^7.3", + "laravel-lang/publisher": "^13.0", + "laravel/breeze": "^1.2", + "laravel/fortify": "^1.7", + "laravel/jetstream": "^2.3", + "laravel/ui": "^3.4", + "orchestra/testbench": "^7.0", + "php": "^8.1", + "phpunit/phpunit": "^9.5", + "symfony/finder": "^6.0", + "symfony/var-dumper": "^6.0", + "vlucas/phpdotenv": "^5.4.1" + }, + "suggest": { + "arcanedev/laravel-lang": "Translations manager and checker for Laravel 5", + "laravel-lang/publisher": "Easy installation and update of translation files for your project", + "overtrue/laravel-lang": "Command to add languages in your project" + }, + "type": "library", + "autoload": { + "psr-4": { + "LaravelLang\\Lang\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Laravel-Lang Team", + "homepage": "https://github.com/Laravel-Lang" + } + ], + "description": "Languages for Laravel", + "keywords": [ + "lang", + "languages", + "laravel", + "lpm" + ], + "support": { + "issues": "https://github.com/Laravel-Lang/lang/issues", + "source": "https://github.com/Laravel-Lang/lang" + }, + "funding": [ + { + "url": "https://opencollective.com/laravel-lang", + "type": "open_collective" + } + ], + "time": "2022-06-27T01:57:27+00:00" + }, + { + "name": "laravel-lang/publisher", + "version": "v12.2.1", + "source": { + "type": "git", + "url": "https://github.com/Laravel-Lang/publisher.git", + "reference": "200a9aca41529ce33d3385e7ffd3e60aaaf808de" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Laravel-Lang/publisher/zipball/200a9aca41529ce33d3385e7ffd3e60aaaf808de", + "reference": "200a9aca41529ce33d3385e7ffd3e60aaaf808de", + "shasum": "" + }, + "require": { + "dragon-code/contracts": "^2.15", + "dragon-code/pretty-array": "^3.0", + "dragon-code/support": "^5.6", + "ext-json": "*", + "illuminate/console": "^7.0 || ^8.0 || ^9.0", + "illuminate/contracts": "^7.0 || ^8.0 || ^9.0", + "illuminate/support": "^7.0 || ^8.0 || ^9.0", + "php": "^7.3 || ^8.0" + }, + "conflict": { + "andrey-helldar/laravel-lang-publisher": "*", + "dragon-code/contracts": "<2.0.0", + "dragon-code/pretty-array": "<3.0.0", + "dragon-code/support": "<5.0.0", + "laravel-lang/lang": "<10.2.0" + }, + "require-dev": { + "laravel-lang/http-statuses": "^2.0", + "laravel-lang/lang": "^10.2", + "orchestra/testbench": "^5.0 || ^6.0 || ^7.0", + "phpunit/phpunit": "^9.4", + "symfony/var-dumper": "^5.0 || ^6.0" + }, + "suggest": { + "laravel-lang/http-statuses": "List of 78 languages for HTTP statuses", + "laravel-lang/lang": "List of 78 languages for Laravel Framework, Jetstream, Fortify, Breeze, Cashier, Nova, Spark and UI." + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "LaravelLang\\Publisher\\ServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "LaravelLang\\Publisher\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Andrey Helldar", + "email": "helldar@ai-rus.com" + } + ], + "description": "Publisher lang files for the Laravel and Lumen Frameworks, Jetstream, Fortify, Cashier, Spark and Nova from Laravel-Lang/lang", + "keywords": [ + "breeze", + "cashier", + "fortify", + "framework", + "i18n", + "jetstream", + "lang", + "languages", + "laravel", + "locale", + "locales", + "localization", + "lpm", + "lumen", + "nova", + "publisher", + "spark", + "trans", + "translations", + "validations" + ], + "support": { + "issues": "https://github.com/Laravel-Lang/publisher/issues", + "source": "https://github.com/Laravel-Lang/publisher" + }, + "funding": [ + { + "url": "https://opencollective.com/laravel-lang", + "type": "open_collective" + } + ], + "time": "2022-03-06T12:54:14+00:00" + }, { "name": "laravel/framework", "version": "v8.83.27", diff --git a/config/app.php b/config/app.php index f82fbbe..9a6c293 100644 --- a/config/app.php +++ b/config/app.php @@ -67,7 +67,7 @@ return [ | to any of the locales which will be supported by the application. | */ - 'locale' => 'ru', + 'locale' => env('APP_LOCALE', 'ru'), /* |-------------------------------------------------------------------------- | Application Fallback Locale @@ -78,7 +78,7 @@ return [ | the language folders that are provided through your application. | */ - 'fallback_locale' => 'en', + 'fallback_locale' => env('APP_FALLBACK_LOCALE', 'en'), /* |-------------------------------------------------------------------------- | Faker Locale diff --git a/database/migrations/2023_05_29_183212_create_pages_table.php b/database/migrations/2023_05_29_183212_create_pages_table.php index e5b2eda..e273793 100644 --- a/database/migrations/2023_05_29_183212_create_pages_table.php +++ b/database/migrations/2023_05_29_183212_create_pages_table.php @@ -17,11 +17,14 @@ class CreatePagesTable extends Migration $table->id(); $table->char('uuid', 36)->index()->unique(); $table->integer('parent_id')->index()->default(0); + $table->integer('picture_id')->index()->nullable(); $table->string('slug')->index()->nullable(); $table->string('type')->index()->nullable(); $table->string('sub_type')->index()->nullable(); $table->string('name')->index()->nullable(); $table->string('title')->index()->nullable(); + $table->text('description')->nullable(); + $table->string('keywords')->index()->nullable(); $table->string('h1')->index()->nullable(); $table->integer('ord')->index()->default(0); $table->timestamps(); diff --git a/database/migrations/2023_11_05_224607_create_locales_table.php b/database/migrations/2023_11_05_224607_create_locales_table.php new file mode 100644 index 0000000..33386e8 --- /dev/null +++ b/database/migrations/2023_11_05_224607_create_locales_table.php @@ -0,0 +1,38 @@ +id(); + $table->char('uuid', 36)->index()->unique(); + $table->string('name', 20)->nullable()->index(); + $table->string('name_iso', 20)->nullable()->index(); + $table->string('title')->nullable()->index(); + $table->boolean('is_enabled')->default(0)->index(); + $table->boolean('is_default')->default(0)->index(); + $table->timestamps(); + $table->softDeletes(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('locales'); + } +} diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index d520623..9402df2 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -5,6 +5,7 @@ namespace Database\Seeders; use Database\Seeders\Advisories\AdvisoriesTablesSeeder; use Database\Seeders\Companies\CompaniesTablesSeeder; use Database\Seeders\Dictionaries\DictionariesTablesSeeder; +use Database\Seeders\Localization\LocalesTableSeeder; use Database\Seeders\Objects\ObjectsTablesSeeder; use Database\Seeders\Pages\PagesTableSeeder; use Database\Seeders\Users\RoleTableSeeder; @@ -16,6 +17,7 @@ class DatabaseSeeder extends Seeder { public function run() { $this->call(RoleTableSeeder::class); $this->call(UsersTableSeeder::class); + $this->call(LocalesTableSeeder::class); $this->call(ObjectsTablesSeeder::class); $this->call(DictionariesTablesSeeder::class); $this->call(PagesTableSeeder::class); diff --git a/database/seeders/Localization/LocalesTableSeeder.php b/database/seeders/Localization/LocalesTableSeeder.php new file mode 100644 index 0000000..7cb1a0a --- /dev/null +++ b/database/seeders/Localization/LocalesTableSeeder.php @@ -0,0 +1,21 @@ + ['title' => 'Русский', 'is_enabled' => true, 'is_default' => true], + 'en' => ['title' => 'English', 'is_enabled' => true], + 'ua' => ['title' => 'Українська', 'is_enabled' => true] + ]; + + public function run() { + collect($this->locales)->each(function($data, $name) { + $model = Locale::firstOrCreate(['name' => $name]); + $model->update(collect($data)->all()); + }); + } +} diff --git a/resources/lang/ru.json b/resources/lang/ru.json new file mode 100644 index 0000000..eec18d0 --- /dev/null +++ b/resources/lang/ru.json @@ -0,0 +1,51 @@ +{ + "A fresh verification link has been sent to your email address.": "Новая ссылка подтверждения отправлена на Ваш адрес электронной почты.", + "All rights reserved.": "Все права защищены.", + "Before proceeding, please check your email for a verification link.": "Прежде чем продолжить, проверьте свою электронную почту на наличие ссылки для подтверждения.", + "click here to request another": "нажмите здесь для запроса другой ссылки", + "Confirm Password": "Подтверждение пароля", + "E-Mail Address": "Email адрес", + "Forbidden": "Запрещено", + "Forgot Your Password?": "Забыли пароль?", + "Go Home": "Домой", + "Go to page :page": "Перейти к :page-й странице", + "Hello!": "Здравствуйте!", + "If you did not create an account, no further action is required.": "Если Вы не создавали учетную запись, никаких дополнительных действий не требуется.", + "If you did not receive the email": "Если Вы не получили письмо", + "If you did not request a password reset, no further action is required.": "Если Вы не запрашивали сброс пароля, то дополнительных действий не требуется.", + "If you're having trouble clicking the \":actionText\" button, copy and paste the URL below\ninto your web browser:": "Если у вас возникли проблемы с нажатием кнопки \":actionText\", скопируйте и вставьте приведенный ниже URL-адрес в свой браузер:", + "Login": "Войти", + "Logout": "Выйти", + "Name": "Имя", + "Not Found": "Не найдено", + "of": "из", + "Oh no": "О, нет", + "Page Expired": "Страница устарела", + "Pagination Navigation": "Навигация", + "Password": "Пароль", + "Please click the button below to verify your email address.": "Пожалуйста, нажмите кнопку ниже, чтобы подтвердить свой адрес электронной почты.", + "Regards": "С уважением", + "Register": "Регистрация", + "Remember Me": "Запомнить меня", + "Reset Password": "Сбросить пароль", + "Reset Password Notification": "Уведомление сброса пароля", + "results": "результатов", + "Send Password Reset Link": "Отправить ссылку сброса пароля", + "Server Error": "Ошибка сервера", + "Service Unavailable": "Сервис недоступен", + "Showing": "Показано с", + "The :attribute must contain at least one letter.": "Значение поля :attribute должно содержать минимум одну букву.", + "The :attribute must contain at least one number.": "Значение поля :attribute должно содержать минимум одну цифру.", + "The :attribute must contain at least one symbol.": "Значение поля :attribute должно содержать минимум один спец символ.", + "The :attribute must contain at least one uppercase and one lowercase letter.": "Значение поля :attribute должно содержать как минимум по одному символу в нижнем и верхнем регистрах.", + "The given :attribute has appeared in a data leak. Please choose a different :attribute.": "Значение поля :attribute обнаружено в утечке данных. Пожалуйста, укажите другое значение для :attribute.", + "This password reset link will expire in :count minutes.": "Срок действия ссылки для сброса пароля истекает через :count минут.", + "to": "по", + "Toggle navigation": "Переключить навигацию", + "Too Many Requests": "Слишком много запросов", + "Unauthorized": "Не авторизован", + "Verify Email Address": "Подтвердить email-адрес", + "Verify Your Email Address": "Подтвердите Ваш email-адрес", + "Whoops!": "Упс!", + "You are receiving this email because we received a password reset request for your account.": "Вы получили это письмо, потому что мы получили запрос на сброс пароля для Вашей учетной записи." +} diff --git a/resources/lang/ru/auth.php b/resources/lang/ru/auth.php index a876598..3ce3c7a 100644 --- a/resources/lang/ru/auth.php +++ b/resources/lang/ru/auth.php @@ -1,18 +1,7 @@ 'Указаны не верные данные учетой записи.', - 'throttle' => 'Слишком много попыток. Попробуйте снова через :seconds секунд.' + 'failed' => 'Неверное имя пользователя или пароль.', + 'password' => 'Неверный пароль.', + 'throttle' => 'Слишком много попыток входа. Пожалуйста, попробуйте еще раз через :seconds секунд.', ]; diff --git a/resources/lang/ru/http-statuses.php b/resources/lang/ru/http-statuses.php new file mode 100644 index 0000000..aa5b62f --- /dev/null +++ b/resources/lang/ru/http-statuses.php @@ -0,0 +1,76 @@ + 'Неизвестная ошибка', + '100' => 'Продолжай', + '101' => 'Переключение протоколов', + '102' => 'Идет обработка', + '200' => 'ОК', + '201' => 'Создано', + '202' => 'Принято', + '203' => 'Информация не авторитетна', + '204' => 'Содержимое отсутствует', + '205' => 'Сбросить содержимое', + '206' => 'Частичное содержимое', + '207' => 'Много статусов', + '208' => 'Уже сообщалось', + '226' => 'Использовано IM', + '300' => 'Множество выбора', + '301' => 'Перемещено навсегда', + '302' => 'Найдено', + '303' => 'Смотри другое', + '304' => 'Не изменялось', + '305' => 'Используй прокси', + '307' => 'Временное перенаправление', + '308' => 'Постоянное перенаправление', + '400' => 'Некорректный запрос', + '401' => 'Не авторизован', + '402' => 'Необходима оплата', + '403' => 'Доступ запрещен', + '404' => 'Страница не найдена', + '405' => 'Метод запрещен', + '406' => 'Неприемлемо', + '407' => 'Требуется аутентификация прокси', + '408' => 'Истекло время ожидания', + '409' => 'Конфликт', + '410' => 'Удалено', + '411' => 'Необходима длина', + '412' => 'Условие ложно', + '413' => 'Полезная нагрузка слишком велика', + '414' => 'URI слишком длинный', + '415' => 'Неподдерживаемый тип данных', + '416' => 'Диапазон недостижим', + '417' => 'Ожидание не удалось', + '418' => 'Я - чайник', + '419' => 'Сессия устарела', + '421' => 'Неверный запрос', + '422' => 'Необрабатываемый экземпляр', + '423' => 'Доступ заблокирован', + '424' => 'Ошибка зависимости', + '426' => 'Требуется обновление', + '428' => 'Требуется предусловие', + '429' => 'Слишком много запросов', + '431' => 'Поля заголовка слишком большие', + '449' => 'Повторить с', + '451' => 'Недоступно по юридическим причинам', + '500' => 'Внутренняя ошибка сервера', + '501' => 'Не реализовано', + '502' => 'Плохой шлюз', + '503' => 'Ведутся технические работы', + '504' => 'Шлюз не отвечает', + '505' => 'Версия HTTP не поддерживается', + '506' => 'Вариант тоже проводит согласование', + '507' => 'Переполнение хранилища', + '508' => 'Обнаружено бесконеечное перенаправление', + '509' => 'Исчерпана пропускная ширина канала', + '510' => 'Не расширено', + '511' => 'Требуется сетевая аутентификация', + '520' => 'Неизвестная ошибка', + '521' => 'Веб-сервер не работает', + '522' => 'Соединение не отвечает', + '523' => 'Источник недоступен', + '524' => 'Время ожидания истекло', + '525' => 'Квитирование SSL не удалось', + '526' => 'Недействительный SSL сертификат', + 'unknownError' => 'Неизвестная ошибка', +]; diff --git a/resources/lang/ru/pagination.php b/resources/lang/ru/pagination.php index 90e7b72..31b85aa 100644 --- a/resources/lang/ru/pagination.php +++ b/resources/lang/ru/pagination.php @@ -1,19 +1,6 @@ 'Вперёд »', 'previous' => '« Назад', - 'next' => 'Вперед »', - ]; diff --git a/resources/lang/ru/passwords.php b/resources/lang/ru/passwords.php index 42a0256..dc48d9d 100644 --- a/resources/lang/ru/passwords.php +++ b/resources/lang/ru/passwords.php @@ -1,22 +1,9 @@ 'Пароль был сброшен!', - 'sent' => 'Ссылка для сброса пароля была отправлена на ваш email адрес!', - 'token' => 'Не корректный токен сброса пароля.', - 'user' => "Пользователя с указанным email адресом не найдено.", - 'throttled' => 'Повторите попытку позже.', - + 'reset' => 'Ваш пароль был сброшен!', + 'sent' => 'Ссылка на сброс пароля была отправлена!', + 'throttled' => 'Пожалуйста, подождите перед повторной попыткой.', + 'token' => 'Ошибочный код сброса пароля.', + 'user' => 'Не удалось найти пользователя с указанным электронным адресом.', ]; diff --git a/resources/lang/ru/validation.php b/resources/lang/ru/validation.php index d8cc40f..d68232d 100644 --- a/resources/lang/ru/validation.php +++ b/resources/lang/ru/validation.php @@ -1,151 +1,198 @@ 'The :attribute must be accepted.', - 'active_url' => 'The :attribute is not a valid URL.', - 'after' => 'The :attribute must be a date after :date.', - 'after_or_equal' => 'The :attribute must be a date after or equal to :date.', - 'alpha' => 'The :attribute may only contain letters.', - 'alpha_dash' => 'The :attribute may only contain letters, numbers, dashes and underscores.', - 'alpha_num' => 'The :attribute may only contain letters and numbers.', - 'array' => 'В поле :attribute должен быть передан массив.', - 'before' => 'The :attribute must be a date before :date.', - 'before_or_equal' => 'The :attribute must be a date before or equal to :date.', - 'between' => [ - 'numeric' => 'The :attribute must be between :min and :max.', - 'file' => 'The :attribute must be between :min and :max kilobytes.', - 'string' => 'The :attribute must be between :min and :max characters.', - 'array' => 'The :attribute must have between :min and :max items.', + 'accepted' => 'Вы должны принять :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 должно быть массивом.', + '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' => 'The :attribute field must be true or false.', - 'confirmed' => 'Подтверждение поля :attribute не совпадает.', - 'date' => 'Значение поля :attribute не является датой.', - 'date_equals' => 'The :attribute must be a date equal to :date.', - 'date_format' => 'The :attribute does not match the format :format.', - 'different' => 'The :attribute and :other must be different.', - 'digits' => 'The :attribute must be :digits digits.', - 'digits_between' => 'The :attribute must be between :min and :max digits.', - 'dimensions' => 'The :attribute has invalid image dimensions.', - 'distinct' => 'The :attribute field has a duplicate value.', - 'email' => 'Поле :attribute должно содержать корректный email адрес.', - 'ends_with' => 'The :attribute must end with one of the following: :values', - 'exists' => 'Не корректное значение поля :attribute.', - 'file' => 'The :attribute must be a file.', - 'filled' => 'Требуется указать значение для поля :attribute.', - 'gt' => [ - 'numeric' => 'The :attribute must be greater than :value.', - 'file' => 'The :attribute must be greater than :value kilobytes.', - 'string' => 'The :attribute must be greater than :value characters.', - 'array' => 'The :attribute must have more than :value items.', + 'boolean' => 'Значение поля :attribute должно быть логического типа.', + 'confirmed' => 'Значение поля :attribute не совпадает с подтверждаемым.', + 'current_password' => 'Неверный пароль.', + 'date' => 'Значение поля :attribute не является датой.', + 'date_equals' => 'Значение поля :attribute должно быть датой равной :date.', + 'date_format' => 'Значение поля :attribute не соответствует формату даты :format.', + 'declined' => 'Поле :attribute должно быть отклонено.', + 'declined_if' => 'Поле :attribute должно быть отклонено, когда :other равно :value.', + 'different' => 'Значения полей :attribute и :other должны различаться.', + 'digits' => 'Длина значения цифрового поля :attribute должна быть :digits.', + 'digits_between' => 'Длина значения цифрового поля :attribute должна быть между :min и :max.', + 'dimensions' => 'Изображение в поле :attribute имеет недопустимые размеры.', + 'distinct' => 'Значения поля :attribute не должны повторяться.', + 'email' => 'Значение поля :attribute должно быть действительным электронным адресом.', + 'ends_with' => 'Поле :attribute должно заканчиваться одним из следующих значений: :values', + 'enum' => 'Выбранное значение для :attribute некорректно.', + 'exists' => 'Выбранное значение для :attribute некорректно.', + 'file' => 'В поле :attribute должен быть указан файл.', + 'filled' => 'Поле :attribute обязательно для заполнения.', + 'gt' => [ + 'array' => 'Количество элементов в поле :attribute должно быть больше :value.', + 'file' => 'Размер файла в поле :attribute должен быть больше :value Килобайт(а).', + 'numeric' => 'Значение поля :attribute должно быть больше :value.', + 'string' => 'Количество символов в поле :attribute должно быть больше :value.', ], - 'gte' => [ - 'numeric' => 'The :attribute must be greater than or equal :value.', - 'file' => 'The :attribute must be greater than or equal :value kilobytes.', - 'string' => 'The :attribute must be greater than or equal :value characters.', - 'array' => 'The :attribute must have :value items or more.', + 'gte' => [ + 'array' => 'Количество элементов в поле :attribute должно быть :value или больше.', + 'file' => 'Размер файла в поле :attribute должен быть :value Килобайт(а) или больше.', + 'numeric' => 'Значение поля :attribute должно быть :value или больше.', + 'string' => 'Количество символов в поле :attribute должно быть :value или больше.', ], - 'image' => 'The :attribute must be an image.', - 'in' => 'The selected :attribute is invalid.', - 'in_array' => 'The :attribute field does not exist in :other.', - 'integer' => 'The :attribute must be an integer.', - 'ip' => 'The :attribute must be a valid IP address.', - 'ipv4' => 'The :attribute must be a valid IPv4 address.', - 'ipv6' => 'The :attribute must be a valid IPv6 address.', - 'json' => 'The :attribute must be a valid JSON string.', - 'lt' => [ - 'numeric' => 'The :attribute must be less than :value.', - 'file' => 'The :attribute must be less than :value kilobytes.', - 'string' => 'The :attribute must be less than :value characters.', - 'array' => 'The :attribute must have less than :value items.', + 'image' => 'Файл в поле :attribute должен быть изображением.', + 'in' => 'Выбранное значение для :attribute некорректно.', + 'in_array' => 'Значение поля :attribute не существует в :other.', + 'integer' => 'Значение поля :attribute должно быть целым числом.', + 'ip' => 'Значение поля :attribute должно быть действительным IP-адресом.', + 'ipv4' => 'Значение поля :attribute должно быть действительным IPv4-адресом.', + 'ipv6' => 'Значение поля :attribute должно быть действительным IPv6-адресом.', + 'json' => 'Значение поля :attribute должно быть JSON строкой.', + 'lt' => [ + 'array' => 'Количество элементов в поле :attribute должно быть меньше :value.', + 'file' => 'Размер файла в поле :attribute должен быть меньше :value Килобайт(а).', + 'numeric' => 'Значение поля :attribute должно быть меньше :value.', + 'string' => 'Количество символов в поле :attribute должно быть меньше :value.', ], - 'lte' => [ - 'numeric' => 'The :attribute must be less than or equal :value.', - 'file' => 'The :attribute must be less than or equal :value kilobytes.', - 'string' => 'The :attribute must be less than or equal :value characters.', - 'array' => 'The :attribute must not have more than :value items.', + 'lte' => [ + 'array' => 'Количество элементов в поле :attribute должно быть :value или меньше.', + 'file' => 'Размер файла в поле :attribute должен быть :value Килобайт(а) или меньше.', + 'numeric' => 'Значение поля :attribute должно быть :value или меньше.', + 'string' => 'Количество символов в поле :attribute должно быть :value или меньше.', ], - 'max' => [ - 'numeric' => 'Значение :attribute должно быть не более :max.', - 'file' => 'Значение :attribute должно быть не более :max килотайт.', - 'string' => 'Значение :attribute должно содержать не более :max символов.', - 'array' => 'Значение :attribute должно содержать не более :max элементов.', + 'mac_address' => 'Значение поля :attribute должно быть корректным MAC-адресом.', + 'max' => [ + 'array' => 'Количество элементов в поле :attribute не может превышать :max.', + 'file' => 'Размер файла в поле :attribute не может быть больше :max Килобайт(а).', + 'numeric' => 'Значение поля :attribute не может быть больше :max.', + 'string' => 'Количество символов в поле :attribute не может превышать :max.', ], - 'mimes' => 'Значение :attribute должно быть файлом типа: :values.', - 'mimetypes' => 'Значение :attribute должно быть файлом типа: :values.', - 'min' => [ - 'numeric' => 'Значение :attribute должно быть не менее :min.', - 'file' => 'Значение :attribute должно быть не менее :min килобайт.', - 'string' => 'Значение :attribute должно содержать не менее :min символов.', - 'array' => 'Значение :attribute должно содержать не менее :min элементов.', + 'mimes' => 'Файл в поле :attribute должен быть одного из следующих типов: :values.', + 'mimetypes' => 'Файл в поле :attribute должен быть одного из следующих типов: :values.', + 'min' => [ + 'array' => 'Количество элементов в поле :attribute должно быть не меньше :min.', + 'file' => 'Размер файла в поле :attribute должен быть не меньше :min Килобайт(а).', + 'numeric' => 'Значение поля :attribute должно быть не меньше :min.', + 'string' => 'Количество символов в поле :attribute должно быть не меньше :min.', ], - 'not_in' => 'Указанное значение :attribute не корректно.', - 'not_regex' => 'Значение поля :attribute не соответствует заданному формату.', - 'numeric' => 'Значение поля :attribute должно быть числовым.', - 'password' => 'Не корректный пароль.', - 'present' => 'Значение поля :attribute должно присутствовать.', - 'regex' => 'Значение поля :attribute не соответствует заданному формату.', - 'required' => 'Требуется указать значение поля :attribute.', - 'required_if' => 'The :attribute field is required when :other is :value.', - '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 and :other must match.', - 'size' => [ - 'numeric' => 'The :attribute must be :size.', - 'file' => 'The :attribute must be :size kilobytes.', - 'string' => 'The :attribute must be :size characters.', - 'array' => 'The :attribute must contain :size items.', + 'multiple_of' => 'Значение поля :attribute должно быть кратным :value', + 'not_in' => 'Выбранное значение для :attribute некорректно.', + 'not_regex' => 'Значение поля :attribute некорректно.', + 'numeric' => 'Значение поля :attribute должно быть числом.', + 'password' => 'Некорректный пароль.', + 'present' => 'Значение поля :attribute должно присутствовать.', + '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_unless' => 'Поле :attribute обязательно для заполнения, когда :other не равно :values.', + 'required_with' => 'Поле :attribute обязательно для заполнения, когда :values указано.', + 'required_with_all' => 'Поле :attribute обязательно для заполнения, когда :values указано.', + 'required_without' => 'Поле :attribute обязательно для заполнения, когда :values не указано.', + 'required_without_all' => 'Поле :attribute обязательно для заполнения, когда ни одно из :values не указано.', + 'same' => 'Значения полей :attribute и :other должны совпадать.', + 'size' => [ + 'array' => 'Количество элементов в поле :attribute должно быть равным :size.', + 'file' => 'Размер файла в поле :attribute должен быть равен :size Килобайт(а).', + 'numeric' => 'Значение поля :attribute должно быть равным :size.', + 'string' => 'Количество символов в поле :attribute должно быть равным :size.', ], - 'starts_with' => 'The :attribute must start with one of the following: :values', - 'string' => 'The :attribute must be a string.', - 'timezone' => 'The :attribute must be a valid zone.', - 'unique' => 'Указанное значение :attribute уже занято.', - 'uploaded' => 'The :attribute failed to upload.', - 'url' => 'The :attribute format is invalid.', - 'uuid' => 'The :attribute 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' => [ + 'starts_with' => 'Поле :attribute должно начинаться с одного из следующих значений: :values', + 'string' => 'Значение поля :attribute должно быть строкой.', + 'timezone' => 'Значение поля :attribute должно быть действительным часовым поясом.', + 'unique' => 'Такое значение поля :attribute уже существует.', + 'uploaded' => 'Загрузка поля :attribute не удалась.', + 'url' => 'Значение поля :attribute имеет ошибочный формат URL.', + 'uuid' => 'Значение поля :attribute должно быть корректным UUID.', + 'attributes' => [ + 'address' => 'адрес', + 'age' => 'возраст', + 'amount' => 'количество', + 'area' => 'область', + 'available' => 'доступно', + 'birthday' => 'дата рождения', + 'body' => 'контент', + 'city' => 'город', + 'content' => 'контент', + 'country' => 'страна', + 'created_at' => 'создано в', + 'creator' => 'создатель', + 'current_password' => 'текущий пароль', + 'date' => 'дата', + 'date_of_birth' => 'день рождения', + 'day' => 'день', + 'deleted_at' => 'удалено в', + 'description' => 'описание', + 'district' => 'округ', + 'duration' => 'продолжительность', + 'email' => 'email адрес', + 'excerpt' => 'выдержка', + 'filter' => 'фильтр', + 'first_name' => 'имя', + 'gender' => 'пол', + 'group' => 'группа', + 'hour' => 'час', + 'image' => 'изображение', + 'last_name' => 'фамилия', + 'lesson' => 'урок', + 'line_address_1' => 'строка адреса 1', + 'line_address_2' => 'строка адреса 2', + 'message' => 'сообщение', + 'middle_name' => 'отчество', + 'minute' => 'минута', + 'mobile' => 'моб. номер', + 'month' => 'месяц', + 'name' => 'имя', + 'national_code' => 'национальный код', + 'number' => 'номер', + 'password' => 'пароль', + 'password_confirmation' => 'подтверждение пароля', + 'phone' => 'номер телефона', + 'photo' => 'фотография', + 'postal_code' => 'индекс', + 'price' => 'стоимость', + 'province' => 'провинция', + 'recaptcha_response_field' => 'ошибка рекапчи', + 'remember' => 'запомнить', + 'restored_at' => 'восстановлено в', + 'result_text_under_image' => 'текст под изображением', + 'role' => 'роль', + 'second' => 'секунда', + 'sex' => 'пол', + 'short_text' => 'короткое описание', + 'size' => 'размер', + 'state' => 'штат', + 'street' => 'улица', + 'student' => 'студент', + 'subject' => 'заголовок', + 'teacher' => 'учитель', + 'terms' => 'правила', + 'test_description' => 'тестовое описание', + 'test_locale' => 'тестовая локализация', + 'test_name' => 'тестовое имя', + 'text' => 'текст', + 'time' => 'время', + 'title' => 'наименование', + 'updated_at' => 'обновлено в', + 'username' => 'никнейм', + 'year' => 'год', + ], + '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' => [], - ]; diff --git a/routes/api.php b/routes/api.php index feb48d5..123f97a 100644 --- a/routes/api.php +++ b/routes/api.php @@ -91,6 +91,15 @@ Route::group(['prefix' => 'advisories'], function() { }); }); +Route::group(['prefix' => 'locales'], function() { + Route::get('/menu', 'Api\Localization\LocalesController@menu'); + Route::get('/{id}', 'Api\Localization\LocalesController@show'); + Route::group(['middleware' => ['auth:api']], function() { + Route::get('/', 'Api\Localization\LocalesController@index'); + Route::delete('/{id}', 'Api\Localization\LocalesController@destroy'); + }); +}); + Route::group(['middleware' => ['auth:api']], function() {