@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function register() |
31 | 31 | { |
32 | - $this->mergeConfigFrom(__DIR__.'/../config/taxonomy.php', 'taxonomy'); |
|
32 | + $this->mergeConfigFrom(__DIR__ . '/../config/taxonomy.php', 'taxonomy'); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | protected function publishConfig() |
@@ -47,10 +47,10 @@ discard block |
||
47 | 47 | |
48 | 48 | protected function publishMigrations() |
49 | 49 | { |
50 | - if (! class_exists('CreateTaxonomiesTable')) { |
|
50 | + if (!class_exists('CreateTaxonomiesTable')) { |
|
51 | 51 | $timestamp = date('Y_m_d_His', time()); |
52 | 52 | |
53 | - $migrationPath = __DIR__.'/../database/migrations/create_taxonomies_table.php'; |
|
53 | + $migrationPath = __DIR__ . '/../database/migrations/create_taxonomies_table.php'; |
|
54 | 54 | $this->publishes([$migrationPath => database_path('/migrations/' . $timestamp . '_create_taxonomies_table.php'), |
55 | 55 | ], 'taxonomy-migrations'); |
56 | 56 | } |
@@ -58,10 +58,10 @@ discard block |
||
58 | 58 | |
59 | 59 | protected function overrideModels() |
60 | 60 | { |
61 | - $modelPathStub = __DIR__.'/stubs/models/'; |
|
61 | + $modelPathStub = __DIR__ . '/stubs/models/'; |
|
62 | 62 | $modelPath = $this->checkMakeDir(app_path('Models/Taxonomies')) . '/'; |
63 | 63 | |
64 | - if (! class_exists('App\Models\Term\Taxonomies') || ! class_exists('App\Models\Vocabulary\Taxonomies')) { |
|
64 | + if (!class_exists('App\Models\Term\Taxonomies') || !class_exists('App\Models\Vocabulary\Taxonomies')) { |
|
65 | 65 | $this->publishes([ |
66 | 66 | $modelPathStub . 'Term.php.stub' => $modelPath . 'Term.php', |
67 | 67 | $modelPathStub . 'Vocabulary.php.stub' => $modelPath . 'Vocabulary.php', |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | */ |
50 | 50 | public function scopeTermsByVocabulary($query, $vocabulary) |
51 | 51 | { |
52 | - return $query->whereHas('terms', function ($t) use ($vocabulary) { |
|
52 | + return $query->whereHas('terms', function($t) use ($vocabulary) { |
|
53 | 53 | $t->where('vocabulary', $vocabulary); |
54 | 54 | }); |
55 | 55 | } |
@@ -74,8 +74,8 @@ discard block |
||
74 | 74 | { |
75 | 75 | foreach ($taxonomies as $vocabulary => $terms) { |
76 | 76 | $terms = is_array($terms) ? $terms : [$terms]; |
77 | - if (! empty($terms)) { |
|
78 | - $query->whereHas('terms', function ($t) use ($vocabulary, $terms, $termKey) { |
|
77 | + if (!empty($terms)) { |
|
78 | + $query->whereHas('terms', function($t) use ($vocabulary, $terms, $termKey) { |
|
79 | 79 | $t->where('vocabulary', $vocabulary)->whereIn($termKey, $terms); |
80 | 80 | }); |
81 | 81 | } |
@@ -82,15 +82,15 @@ |
||
82 | 82 | */ |
83 | 83 | public function createTermablesTable() |
84 | 84 | { |
85 | - Schema::create('termables', function (Blueprint $table) { |
|
86 | - $table->unsignedInteger('term_id'); |
|
87 | - $table->morphs('termable'); |
|
85 | + Schema::create('termables', function (Blueprint $table) { |
|
86 | + $table->unsignedInteger('term_id'); |
|
87 | + $table->morphs('termable'); |
|
88 | 88 | |
89 | - $table->foreign('term_id') |
|
90 | - ->references('id') |
|
91 | - ->on('terms') |
|
92 | - ->onDelete('CASCADE'); |
|
93 | - }); |
|
89 | + $table->foreign('term_id') |
|
90 | + ->references('id') |
|
91 | + ->on('terms') |
|
92 | + ->onDelete('CASCADE'); |
|
93 | + }); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function createVocabulariesTable() |
29 | 29 | { |
30 | - Schema::create('vocabularies', function (Blueprint $table) { |
|
30 | + Schema::create('vocabularies', function(Blueprint $table) { |
|
31 | 31 | $table->increments('id'); |
32 | 32 | $table->string('system_name')->unique(); |
33 | 33 | $table->string('name'); |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | */ |
42 | 42 | public function createTermsTable() |
43 | 43 | { |
44 | - Schema::create('terms', function (Blueprint $table) { |
|
44 | + Schema::create('terms', function(Blueprint $table) { |
|
45 | 45 | $table->increments('id'); |
46 | 46 | $table->string('name'); |
47 | 47 | $table->text('description')->nullable(); |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | */ |
67 | 67 | public function createVocabulariablesTable() |
68 | 68 | { |
69 | - Schema::create('vocabularyables', function (Blueprint $table) { |
|
69 | + Schema::create('vocabularyables', function(Blueprint $table) { |
|
70 | 70 | $table->unsignedInteger('vocabulary_id'); |
71 | 71 | $table->morphs('vocabularyable'); |
72 | 72 | |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | */ |
83 | 83 | public function createTermablesTable() |
84 | 84 | { |
85 | - Schema::create('termables', function (Blueprint $table) { |
|
85 | + Schema::create('termables', function(Blueprint $table) { |
|
86 | 86 | $table->unsignedInteger('term_id'); |
87 | 87 | $table->morphs('termable'); |
88 | 88 |
@@ -37,86 +37,86 @@ |
||
37 | 37 | { |
38 | 38 | return [ |
39 | 39 | [ |
40 | - 'system_name' => 'product_categories', |
|
41 | - 'name' => 'Категории товаров', |
|
42 | - 'description' => 'Словарь категорий товаров магазина', |
|
43 | - 'terms' => [ |
|
44 | - [ |
|
45 | - 'name' => 'Автоэлектроника', |
|
46 | - 'description' => 'Электроника для вашего авто', |
|
47 | - 'terms' => [ |
|
48 | - ['name' => 'Автосигнализации', 'description' => 'Автосигнализации и соп. товары'], |
|
49 | - ['name' => 'GPS навигаторы', 'description' => 'GPS навигаторы и треккеры'], |
|
50 | - ], |
|
51 | - ], |
|
52 | - ['name' => 'Колеса и диски', 'description' => 'Шины, диски, колпаки'], |
|
53 | - [ |
|
54 | - 'name' => 'Автохимия', |
|
55 | - 'description' => 'Автохимия и автокосметика', |
|
56 | - 'terms' => [ |
|
57 | - ['name' => 'Омиватели', 'description' => 'Омиватели летние и зимнии для стекла'], |
|
58 | - [ |
|
59 | - 'name' => 'Чистка кузова', |
|
60 | - 'description' => 'Инструменты и химия для чистки кузова', |
|
61 | - 'terms' => [ |
|
62 | - ['name' => 'Полироли', 'description' => 'Полироли для кузова'], |
|
63 | - ], |
|
64 | - ], |
|
65 | - ], |
|
66 | - ], |
|
67 | - ['name' => 'Тюнинг', 'description' => 'Спойлеры и наклейки для кузова авто'], |
|
68 | - ], |
|
40 | + 'system_name' => 'product_categories', |
|
41 | + 'name' => 'Категории товаров', |
|
42 | + 'description' => 'Словарь категорий товаров магазина', |
|
43 | + 'terms' => [ |
|
44 | + [ |
|
45 | + 'name' => 'Автоэлектроника', |
|
46 | + 'description' => 'Электроника для вашего авто', |
|
47 | + 'terms' => [ |
|
48 | + ['name' => 'Автосигнализации', 'description' => 'Автосигнализации и соп. товары'], |
|
49 | + ['name' => 'GPS навигаторы', 'description' => 'GPS навигаторы и треккеры'], |
|
50 | + ], |
|
51 | + ], |
|
52 | + ['name' => 'Колеса и диски', 'description' => 'Шины, диски, колпаки'], |
|
53 | + [ |
|
54 | + 'name' => 'Автохимия', |
|
55 | + 'description' => 'Автохимия и автокосметика', |
|
56 | + 'terms' => [ |
|
57 | + ['name' => 'Омиватели', 'description' => 'Омиватели летние и зимнии для стекла'], |
|
58 | + [ |
|
59 | + 'name' => 'Чистка кузова', |
|
60 | + 'description' => 'Инструменты и химия для чистки кузова', |
|
61 | + 'terms' => [ |
|
62 | + ['name' => 'Полироли', 'description' => 'Полироли для кузова'], |
|
63 | + ], |
|
64 | + ], |
|
65 | + ], |
|
66 | + ], |
|
67 | + ['name' => 'Тюнинг', 'description' => 'Спойлеры и наклейки для кузова авто'], |
|
68 | + ], |
|
69 | 69 | ], |
70 | 70 | [ |
71 | - 'system_name' => 'regions', |
|
72 | - 'name' => 'Регионы', |
|
73 | - 'description' => 'Словарь регионов страны', |
|
74 | - 'terms' => [ |
|
75 | - ['name' => 'Кировоградская', 'description' => 'Кировоградская область'], |
|
76 | - ['name' => 'Волынская', 'description' => 'Волынская область'], |
|
77 | - ['name' => 'Киевская', 'description' => 'Киевская область'], |
|
78 | - ['name' => 'Донецкая', 'description' => 'Донецкая область'], |
|
79 | - ], |
|
71 | + 'system_name' => 'regions', |
|
72 | + 'name' => 'Регионы', |
|
73 | + 'description' => 'Словарь регионов страны', |
|
74 | + 'terms' => [ |
|
75 | + ['name' => 'Кировоградская', 'description' => 'Кировоградская область'], |
|
76 | + ['name' => 'Волынская', 'description' => 'Волынская область'], |
|
77 | + ['name' => 'Киевская', 'description' => 'Киевская область'], |
|
78 | + ['name' => 'Донецкая', 'description' => 'Донецкая область'], |
|
79 | + ], |
|
80 | 80 | ], |
81 | 81 | [ |
82 | - 'system_name' => 'quantities', |
|
83 | - 'name' => 'Единицы измерения количества', |
|
84 | - 'description' => 'Словарь едениц измерения количества товаров/услуг', |
|
85 | - 'terms' => [ |
|
86 | - ['name' => 'см.', 'description' => 'сантиметров', 'slug' => ''], |
|
87 | - ['name' => 'т.', 'description' => 'тонн', 'slug' => ''], |
|
88 | - ['name' => 'шт.', 'description' => 'штук', 'slug' => ''], |
|
89 | - ], |
|
82 | + 'system_name' => 'quantities', |
|
83 | + 'name' => 'Единицы измерения количества', |
|
84 | + 'description' => 'Словарь едениц измерения количества товаров/услуг', |
|
85 | + 'terms' => [ |
|
86 | + ['name' => 'см.', 'description' => 'сантиметров', 'slug' => ''], |
|
87 | + ['name' => 'т.', 'description' => 'тонн', 'slug' => ''], |
|
88 | + ['name' => 'шт.', 'description' => 'штук', 'slug' => ''], |
|
89 | + ], |
|
90 | 90 | ], |
91 | 91 | [ |
92 | - 'system_name' => 'payment_methods', |
|
93 | - 'name' => 'Способы оплаты', |
|
94 | - 'description' => 'Словарь способов оплаты товаров/услуг', |
|
95 | - 'terms' => [ |
|
96 | - ['name' => 'предоплата', 'description' => 'оплата проводится наперед', 'system_name' => 'pay_predoplata', 'slug' => ''], |
|
97 | - ['name' => 'оплата при получении', 'description' => 'оплата проводится при получении товара', 'system_name' => 'pay_pri_poluchenii', 'slug' => ''], |
|
98 | - ], |
|
92 | + 'system_name' => 'payment_methods', |
|
93 | + 'name' => 'Способы оплаты', |
|
94 | + 'description' => 'Словарь способов оплаты товаров/услуг', |
|
95 | + 'terms' => [ |
|
96 | + ['name' => 'предоплата', 'description' => 'оплата проводится наперед', 'system_name' => 'pay_predoplata', 'slug' => ''], |
|
97 | + ['name' => 'оплата при получении', 'description' => 'оплата проводится при получении товара', 'system_name' => 'pay_pri_poluchenii', 'slug' => ''], |
|
98 | + ], |
|
99 | 99 | ], |
100 | 100 | [ |
101 | - 'system_name' => 'post_statuses', |
|
102 | - 'name' => 'Статусы объявлений', |
|
103 | - 'description' => 'Статусы модерации объявлений', |
|
104 | - 'terms' => [ |
|
105 | - ['name' => 'На модерации', 'description' => 'Обявление находится на модерации', 'system_name' => 'post_moderation', 'slug' => ''], |
|
106 | - ['name' => 'Опубликовано', 'description' => 'Обявление успешно опубликовано', 'system_name' => 'post_published', 'slug' => ''], |
|
107 | - ['name' => 'Отклонено', 'description' => 'Обявление отклонено для публикации', 'system_name' => 'post_rejected', 'slug' => ''], |
|
108 | - ['name' => 'В архиве', 'description' => 'Обявление находится в архиве', 'system_name' => 'post_archived', 'slug' => ''], |
|
109 | - ], |
|
101 | + 'system_name' => 'post_statuses', |
|
102 | + 'name' => 'Статусы объявлений', |
|
103 | + 'description' => 'Статусы модерации объявлений', |
|
104 | + 'terms' => [ |
|
105 | + ['name' => 'На модерации', 'description' => 'Обявление находится на модерации', 'system_name' => 'post_moderation', 'slug' => ''], |
|
106 | + ['name' => 'Опубликовано', 'description' => 'Обявление успешно опубликовано', 'system_name' => 'post_published', 'slug' => ''], |
|
107 | + ['name' => 'Отклонено', 'description' => 'Обявление отклонено для публикации', 'system_name' => 'post_rejected', 'slug' => ''], |
|
108 | + ['name' => 'В архиве', 'description' => 'Обявление находится в архиве', 'system_name' => 'post_archived', 'slug' => ''], |
|
109 | + ], |
|
110 | 110 | ], |
111 | 111 | [ |
112 | - 'system_name' => 'payment_statuses', |
|
113 | - 'name' => 'Статусы оплат', |
|
114 | - 'description' => 'Статусы оплат услуг на сайте', |
|
115 | - 'terms' => [ |
|
116 | - ['name' => 'Новый платеж', 'system_name' => 'payment_new', 'slug' => ''], |
|
117 | - ['name' => 'Платеж подтвежден', 'system_name' => 'payment_success', 'slug' => ''], |
|
118 | - ['name' => 'Платеж отклонен', 'system_name' => 'payment_rejected', 'slug' => ''], |
|
119 | - ], |
|
112 | + 'system_name' => 'payment_statuses', |
|
113 | + 'name' => 'Статусы оплат', |
|
114 | + 'description' => 'Статусы оплат услуг на сайте', |
|
115 | + 'terms' => [ |
|
116 | + ['name' => 'Новый платеж', 'system_name' => 'payment_new', 'slug' => ''], |
|
117 | + ['name' => 'Платеж подтвежден', 'system_name' => 'payment_success', 'slug' => ''], |
|
118 | + ['name' => 'Платеж отклонен', 'system_name' => 'payment_rejected', 'slug' => ''], |
|
119 | + ], |
|
120 | 120 | ], |
121 | 121 | ]; |
122 | 122 | } |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | 'description' => $item['description'] ?? null, |
134 | 134 | ]); |
135 | 135 | |
136 | - if (! empty($item['terms'])) { |
|
136 | + if (!empty($item['terms'])) { |
|
137 | 137 | $this->seedTerms($item['terms'], $vocabulary); |
138 | 138 | } |
139 | 139 | } |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | 'parent_id' => $parentId, |
156 | 156 | ]); |
157 | 157 | |
158 | - if (! empty($item['terms'])) { |
|
158 | + if (!empty($item['terms'])) { |
|
159 | 159 | $this->seedTerms($item['terms'], $vocabulary, $term->id); |
160 | 160 | } |
161 | 161 | } |