Skip to content

Is there any way to create a model related to another model(s) via pivot table? #440

@djagya

Description

@djagya

Hi,
Is there any way to automatically create a row inside the pivot table for a model?
For example:
Post <-> Author

If I want to create a Post related to an Author, how do I specify a definition for that?
Unfortunately that doesn't work:

$fm->define(Post::class)->setDefinitions([
    'title' => Faker::name(),
    'author' => 'factory|Author',
]);

Should I do that with a custom maker?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions