@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | */ |
| 40 | 40 | public function save(array $options = []) |
| 41 | 41 | { |
| 42 | - if(strlen($this->name) < 1) { |
|
| 42 | + if (strlen($this->name) < 1) { |
|
| 43 | 43 | throw new \RuntimeException('Cannot save a tag with an empty name'); |
| 44 | 44 | } |
| 45 | 45 | |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | return $this; |
| 67 | 67 | } else { |
| 68 | - throw new \RuntimeException('No Tag Group found: '. $group); |
|
| 68 | + throw new \RuntimeException('No Tag Group found: '.$group); |
|
| 69 | 69 | } |
| 70 | 70 | } |
| 71 | 71 | |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | { |
| 122 | 122 | $groupSlug = TaggingUtility::normalize($groupName); |
| 123 | 123 | |
| 124 | - return $query->whereHas('group', function (Builder $query) use ($groupSlug) { |
|
| 124 | + return $query->whereHas('group', function(Builder $query) use ($groupSlug) { |
|
| 125 | 125 | $query->where('slug', $groupSlug); |
| 126 | 126 | }); |
| 127 | 127 | } |
@@ -5,20 +5,20 @@ |
||
| 5 | 5 | |
| 6 | 6 | class CreateTagsTable extends Migration |
| 7 | 7 | { |
| 8 | - public function up() |
|
| 9 | - { |
|
| 10 | - Schema::create('tagging_tags', function(Blueprint $table) { |
|
| 11 | - $table->increments('id'); |
|
| 12 | - $table->string('slug', 125)->index(); |
|
| 13 | - $table->string('name', 125); |
|
| 14 | - $table->boolean('suggest')->default(false); |
|
| 15 | - $table->integer('count')->unsigned()->default(0); // count of how many times this tag was used |
|
| 8 | + public function up() |
|
| 9 | + { |
|
| 10 | + Schema::create('tagging_tags', function(Blueprint $table) { |
|
| 11 | + $table->increments('id'); |
|
| 12 | + $table->string('slug', 125)->index(); |
|
| 13 | + $table->string('name', 125); |
|
| 14 | + $table->boolean('suggest')->default(false); |
|
| 15 | + $table->integer('count')->unsigned()->default(0); // count of how many times this tag was used |
|
| 16 | 16 | $table->integer('tag_group_id')->unsigned()->nullable(); |
| 17 | - }); |
|
| 18 | - } |
|
| 17 | + }); |
|
| 18 | + } |
|
| 19 | 19 | |
| 20 | - public function down() |
|
| 21 | - { |
|
| 22 | - Schema::drop('tagging_tags'); |
|
| 23 | - } |
|
| 20 | + public function down() |
|
| 21 | + { |
|
| 22 | + Schema::drop('tagging_tags'); |
|
| 23 | + } |
|
| 24 | 24 | } |
@@ -5,20 +5,20 @@ |
||
| 5 | 5 | |
| 6 | 6 | class UpdateTagsTable extends Migration { |
| 7 | 7 | |
| 8 | - public function up() |
|
| 9 | - { |
|
| 10 | - Schema::table('tagging_tags', function ($table) { |
|
| 11 | - $table->foreign('tag_group_id')->references('id')->on('tagging_tag_groups'); |
|
| 12 | - }); |
|
| 8 | + public function up() |
|
| 9 | + { |
|
| 10 | + Schema::table('tagging_tags', function ($table) { |
|
| 11 | + $table->foreign('tag_group_id')->references('id')->on('tagging_tag_groups'); |
|
| 12 | + }); |
|
| 13 | 13 | |
| 14 | - } |
|
| 14 | + } |
|
| 15 | 15 | |
| 16 | 16 | |
| 17 | - public function down() |
|
| 18 | - { |
|
| 17 | + public function down() |
|
| 18 | + { |
|
| 19 | 19 | Schema::disableForeignKeyConstraints(); |
| 20 | - Schema::table('tagging_tags', function ($table) { |
|
| 21 | - $table->dropForeign('tagging_tags_tag_group_id_foreign'); |
|
| 22 | - }); |
|
| 23 | - } |
|
| 20 | + Schema::table('tagging_tags', function ($table) { |
|
| 21 | + $table->dropForeign('tagging_tags_tag_group_id_foreign'); |
|
| 22 | + }); |
|
| 23 | + } |
|
| 24 | 24 | } |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | |
| 8 | 8 | public function up() |
| 9 | 9 | { |
| 10 | - Schema::table('tagging_tags', function ($table) { |
|
| 10 | + Schema::table('tagging_tags', function($table) { |
|
| 11 | 11 | $table->foreign('tag_group_id')->references('id')->on('tagging_tag_groups'); |
| 12 | 12 | }); |
| 13 | 13 | |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | public function down() |
| 18 | 18 | { |
| 19 | 19 | Schema::disableForeignKeyConstraints(); |
| 20 | - Schema::table('tagging_tags', function ($table) { |
|
| 20 | + Schema::table('tagging_tags', function($table) { |
|
| 21 | 21 | $table->dropForeign('tagging_tags_tag_group_id_foreign'); |
| 22 | 22 | }); |
| 23 | 23 | } |