spatie / laravel-tags

Add tags and taggable behaviour to your Laravel app

Home Page:https://freek.dev/609-an-opinionated-tagging-package-for-laravel-apps

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Field 'slug' doesn't have a default value

NicTorgersen opened this issue · comments

commented

I'm using laravel/framework v8.16.0 and spatie/laravel-tags v2.7.2 after I ran a composer update and my tests fail with Field 'slug' doesn't have a default value. It worked fine until I ran an update.

I'm using the $model->syncTagsWithType(array, string) method to add tags to my model.

My config looks like this:

<?php

return [
    /*
     * The given function generates a URL friendly "slug" from the tag name property before saving it.
     * Defaults to Str::slug (https://laravel.com/docs/5.8/helpers#method-str-slug)
     */
    'slugger' => null,
];

composer.json:

{
    "require": {
        "laravel/framework": "^8.0",
        "spatie/laravel-tags": "^2.7"
    }
}
commented

My mistake. Managed to suppress events and noticed boot() uses creating-event to add a slug.

Very well spotted dude. It was driving me insane the entire morning.