File tree Expand file tree Collapse file tree 4 files changed +46
-4
lines changed Expand file tree Collapse file tree 4 files changed +46
-4
lines changed Original file line number Diff line number Diff line change 3838 ]
3939 }
4040 },
41- "minimum-stability" : " dev"
42- }
41+ "minimum-stability" : " dev" ,
42+ "scripts" : {
43+ "test" : " ./vendor/bin/phpunit tests"
44+ }
45+ }
Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 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 */
2122class 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
Original file line number Diff line number Diff 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+ }
You can’t perform that action at this time.
0 commit comments