![]() Logically, you can't get a list of models that have all or any of a list of tags. Passing empty strings or arrays to any of the scope methods is an interesting situation. Otherwise, it will use the default connection (i.e. You can set this to specify that the Tag model should use a different database connection. ConfigurationĬonfiguration is handled through the settings in /app/config/taggable.php. Find all the tags that aren't used by any model: $tagService-> getAllUnusedTags() Īs always, take a look at the code for full documentation of the service class. $tagService-> getPopularTags( $limit, \ App\ Model, $minimumCount) ![]() ![]() $tagService-> getPopularTags( $limit, \ App\ Model) Get the most popular tags across all models, or for just one model: $tagService-> getPopularTags() Rename all tags from "Apple" to "Apricot" across all models: $tagService-> renameTags(" Apple", " Apricot") Rename all tags from "Apple" to "Apricot" for the \App\Model uses // (same as doing \App\Model::renameTag("Apple", "Apricot") ): $tagService-> renameTags(" Apple", " Apricot", \ App\ Model) Return a collection of all the Tag models used by all models: $tagService-> getAllTags() Return a collection of all the Tag models used by \App\Model instances // (same as doing \App\Model::allTagModels() ): $tagService-> getAllTags(\ App\ Model) Instantiate the service (can also be done via dependency injection) $tagService = app(\ Cviebrock\ EloquentTaggable\ Services\ TagService::class) Install the cviebrock/eloquent-taggable package via composer: The master branch by default, which might not be what you want). The correct README.md for your version (GitHub displays the version in UPGRADING.md for specifics, and be sure that you are reading Older versions of Laravel can use older versions of the package, although theyĪre no longer supported or maintained. † Version 3.1 of the package requires PHP 7.0 or later, even though Laravel 5.4 doesn't. Version should match the Laravel version. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |