File tree Expand file tree Collapse file tree 3 files changed +19
-2
lines changed Expand file tree Collapse file tree 3 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ public function up()
1111 $ table ->increments ('id ' );
1212 $ table ->string ('slug ' , 125 )->index ();
1313 $ table ->string ('name ' , 125 );
14+ $ table ->text ('description ' )->nullable ();
1415 $ table ->boolean ('suggest ' )->default (false );
1516 $ table ->integer ('count ' )->unsigned ()->default (0 ); // count of how many times this tag was used
1617 $ table ->integer ('tag_group_id ' )->unsigned ()->nullable ();
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