@@ -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->string('system_name')->nullable()->unique(); // optional |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | */ |
65 | 65 | public function createVocabulariablesTable() |
66 | 66 | { |
67 | - Schema::create('vocabularyables', function (Blueprint $table) { |
|
67 | + Schema::create('vocabularyables', function(Blueprint $table) { |
|
68 | 68 | $table->unsignedInteger('vocabulary_id'); |
69 | 69 | $table->morphs('vocabularyable'); |
70 | 70 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public function createTermablesTable() |
82 | 82 | { |
83 | - Schema::create('termables', function (Blueprint $table) { |
|
83 | + Schema::create('termables', function(Blueprint $table) { |
|
84 | 84 | $table->unsignedInteger('term_id'); |
85 | 85 | $table->morphs('termable'); |
86 | 86 |
@@ -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() |
@@ -48,19 +48,19 @@ discard block |
||
48 | 48 | |
49 | 49 | protected function publishMigrations() |
50 | 50 | { |
51 | - if (! class_exists('CreateTaxonomiesTable')) { |
|
51 | + if (!class_exists('CreateTaxonomiesTable')) { |
|
52 | 52 | $timestamp = date('Y_m_d_His', time()); |
53 | 53 | |
54 | 54 | $this->publishes([ |
55 | - __DIR__.'/../database/migrations/create_taxonomy_tables.php' => database_path('/migrations/' . $timestamp . '_create_taxonomy_tables.php'), |
|
55 | + __DIR__ . '/../database/migrations/create_taxonomy_tables.php' => database_path('/migrations/' . $timestamp . '_create_taxonomy_tables.php'), |
|
56 | 56 | ], 'taxonomy-migrations'); |
57 | 57 | } |
58 | 58 | } |
59 | 59 | |
60 | 60 | protected function overrideModels() |
61 | 61 | { |
62 | - if (! class_exists('App\Models\Term\Taxonomy') || ! class_exists('App\Models\Vocabulary\Taxonomy')) { |
|
63 | - $modelPathStub = __DIR__.'/stubs/models/'; |
|
62 | + if (!class_exists('App\Models\Term\Taxonomy') || !class_exists('App\Models\Vocabulary\Taxonomy')) { |
|
63 | + $modelPathStub = __DIR__ . '/stubs/models/'; |
|
64 | 64 | $modelPath = $this->checkMakeDir(app_path('Models/Taxonomy')) . '/'; |
65 | 65 | |
66 | 66 | $this->publishes([ |