Skip to content

Commit 84c18be

Browse files
committed
Merge branch 'laravel-7' of github.com:rtconner/laravel-tagging into laravel-7
2 parents 522e3c0 + fa13edb commit 84c18be

File tree

4 files changed

+46
-4
lines changed

4 files changed

+46
-4
lines changed

composer.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,8 @@
3838
]
3939
}
4040
},
41-
"minimum-stability": "dev"
42-
}
41+
"minimum-stability": "dev",
42+
"scripts": {
43+
"test": "./vendor/bin/phpunit tests"
44+
}
45+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
6+
class AddDescriptionToTagsTable extends Migration {
7+
8+
public function up()
9+
{
10+
Schema::table('tagging_tags', function ($table) {
11+
$table->text('description')->nullable();
12+
});
13+
14+
}
15+
16+
17+
public function down()
18+
{
19+
Schema::table('tagging_tags', function ($table) {
20+
$table->dropColumn('description');
21+
});
22+
}
23+
}

src/Model/Tag.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@
1515
* @property integer count
1616
* @property integer tag_group_id
1717
* @property TagGroup group
18+
* @property string description
1819
* @method static suggested()
1920
* @method static inGroup(string $group)
2021
*/
2122
class Tag extends Model
2223
{
2324
protected $table = 'tagging_tags';
2425
public $timestamps = false;
25-
public $fillable = ['name'];
26+
public $fillable = ['name', 'description'];
2627

2728
/**
2829
* @param array $attributes

tests/TagBaseTest.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,19 @@ public function test_saving_a_tag()
1515
$this->assertEquals('Foobar', $tag->name);
1616
$this->assertEquals('foobar', $tag->slug);
1717
}
18-
}
18+
19+
public function test_it_can_have_a_description()
20+
{
21+
$description = 'Fooobar test description';
22+
$tag = new Tag([
23+
'name' => 'foobar',
24+
'description' => $description
25+
]);
26+
27+
$tag->save();
28+
29+
$this->assertEquals('Foobar', $tag->name);
30+
$this->assertEquals('foobar', $tag->slug);
31+
$this->assertEquals($description, $tag->description);
32+
}
33+
}

0 commit comments

Comments
 (0)