#Automatically scope relationship (am i using the wrong relationship)?

1 messages · Page 1 of 1 (latest)

lethal knoll
#

I've got Tenants, Artists and ArtistData

One Tenant, can have many Artists.
Artist can have one ArtistData per Tenant and Artist.

    $artist->artistData()->create([
        'description' => 'test',
    ]);```

artistData has two fields, `tenant_id` and `artist_id`.

Is there a way i can define my relationships/other ways to have the `tenant_id` be filled out automatically?
real meadow
#

thinks this is a many to many relationship, have you tried the attached or sync?

$artist->artistData()->attach($tenant->id);
lethal knoll