Skip to content

Commit f5c8583

Browse files
authored
readme: add example apply trait (spatie#403)
1 parent cd2ee03 commit f5c8583

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

README.md

+14
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,20 @@ You'll find the documentation on https://spatie.be/docs/laravel-tags.
1717
Here are some code examples:
1818

1919
```php
20+
// apply HasTags trait to a model
21+
use Illuminate\Database\Eloquent\Model;
22+
use Spatie\Tags\HasTags;
23+
24+
class NewsItem extends Model
25+
{
26+
use HasTags;
27+
28+
// ...
29+
}
30+
```
31+
32+
```php
33+
2034
// create a model with some tags
2135
$newsItem = NewsItem::create([
2236
'name' => 'The Article Title',

0 commit comments

Comments
 (0)