Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UUID on pivot #40

Closed
jayenne opened this issue Nov 23, 2020 · 3 comments
Closed

UUID on pivot #40

jayenne opened this issue Nov 23, 2020 · 3 comments

Comments

@jayenne
Copy link

jayenne commented Nov 23, 2020

hi,
is there a way of creating uuid on pivot?
on seeding, I'm getting General error: 1364 Field 'id' doesn't have a default value

my model is..

use GoldSpecDigital\LaravelEloquentUUID\Database\Eloquent\Model;
class BoardPost extends Model
{
    use Uuid;
    
    public $incrementing = false;
    protected $keyType = 'string';
    protected $primaryKey = 'id';
    
    public static function boot()
    {
        parent::boot();
        self::creating(function ($model) {
            $uuid = (string) Uuid::generate(4);
            $model->id = $uuid;
        });
    }
}

@matthew-inamdar-sky
Copy link

Hi @jayenne 👋

Please take a look at this comment - hopefully, it answers your question: #33 (comment)

@matthew-inamdar
Copy link
Member

@jayenne Did that help? I'll close this issue if so.

@matthew-inamdar
Copy link
Member

Closing due to no reply.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants