Installation and setup | laravel-tags-go | Spatie       

 SPATIE  

laravel-tags-go
===============

spatie.be/open-source

  [Docs](https://spatie.be/docs)  [Laravel-tags-go](https://spatie.be/docs/laravel-tags-go/v1)  Installation and setup

 Version   v1      

 Other versions for crawler [v1](https://spatie.be/docs/laravel-tags-go/v1) 

  Installation and setup    
- [ Introduction ](https://spatie.be/docs/laravel-tags-go/v1/introduction)
- [ Postcardware ](https://spatie.be/docs/laravel-tags-go/v1/postcardware)
- [ Requirements ](https://spatie.be/docs/laravel-tags-go/v1/requirements)
- [ Installation and setup ](https://spatie.be/docs/laravel-tags-go/v1/installation-and-setup)
- [ Questions and issues ](https://spatie.be/docs/laravel-tags-go/v1/questions-and-issues)
- [ Changelog ](https://spatie.be/docs/laravel-tags-go/v1/changelog)
- [ About us ](https://spatie.be/docs/laravel-tags-go/v1/about-us)
- [ Testing ](https://spatie.be/docs/laravel-tags-go/v1/testing)
- [ Releasing ](https://spatie.be/docs/laravel-tags-go/v1/releasing)
- [ Support us ](https://spatie.be/docs/laravel-tags-go/v1/support-us)

Basic usage
-----------

- [ Using tags ](https://spatie.be/docs/laravel-tags-go/v1/basic-usage/using-tags)
- [ Retrieving tagged models ](https://spatie.be/docs/laravel-tags-go/v1/basic-usage/retrieving-tagged-models)

Advanced usage
--------------

- [ Adding translations ](https://spatie.be/docs/laravel-tags-go/v1/advanced-usage/adding-translations)
- [ Using types ](https://spatie.be/docs/laravel-tags-go/v1/advanced-usage/using-types)
- [ Sorting tags ](https://spatie.be/docs/laravel-tags-go/v1/advanced-usage/sorting-tags)
- [ Using your own tag model ](https://spatie.be/docs/laravel-tags-go/v1/advanced-usage/using-your-own-tag-model)
- [ Using another default locale ](https://spatie.be/docs/laravel-tags-go/v1/advanced-usage/using-another-default-locale)

 Installation and setup
======================

You can install the package with Go:

```
go get github.com/spatie/laravel-tags-go@v0.1.0
```

Add the package to `Packages` in `bootstrap/app.go`:

```
laravel.Options{
    Packages: []laravel.Package{tags.New()},
    Drivers: []db.Driver{sqlite.Driver},
}
```

The imports above are `github.com/spatie/laravel-tags-go`, `go.laravel.com`, `go.laravel.com/db` and `go.laravel.com/db/sqlite`. Select PostgreSQL or MySQL instead when appropriate. No database driver is registered by this package.

After configuring `DATABASE_URL`, create the `tags` and `taggables` tables by running the migrations:

```
laravel migrate
```

The package registers forward-only migrations. No schema changes happen during application registration. Existing PHP tables do not need to be recreated. Set `Migrate` to false when reusing them or registering your own schema.

You can optionally customize the configuration in Go:

```
tags.New(func(c *tags.Config) {
    c.Locale = "nl"
    c.Translations.FallbackLocale = "en"
    c.Table = "taggables"
    c.MorphName = "taggable"
    c.Migrate = true
    c.Slugger = func(name, locale string) string {
        return str.Slug(str.ASCII(name))
    }
})
```

`str` is `go.laravel.com/str`. The default slugger also replaces `@` with `at`. `TAGS_LOCALE`, `TAGS_TABLE` and `TAGS_MORPH_NAME` supply environment defaults. Configuration callbacks run afterward and take precedence. A package value can be reused across isolated applications without sharing its manager state.

Use `NewFor` to select a custom tag model and `Config.Pivots` for a custom pivot store. Do not register a second manager to override the first one. Laravel Go v0.1.0 returns the first service with a matching type.

 A good
match?
-------------

### What we do best

- All things Laravel
- Custom frontend components
- Building APIs
- AI-powered features
- Simplifying things
- Clean solutions
- Integrating services

### Not our cup of tea

- WordPress themes
- Cutting corners
- Free mockups to win a job
- "Just execute the briefing"

 In short: we'd like to be a **substantial part** of your project.

 [ Get in touch via email ](mailto:info@spatie.be?subject=A%20good%20match%21&body=Tell%20us%20as%20much%20as%20you%20can%20about%0A-%20your%20online%20project%0A-%20your%20planning%0A-%20your%20budget%0A-%20%E2%80%A6%0A%0AAnything%20that%20helps%20us%20to%20start%20straightforward%21)
