Support the ongoing development of Laravel.io →
Eloquent Database
Last updated 2 years ago.
0

Is it only ever going to be created_by and updated_by? What happens if multiple users update the package, you only want to track the person who updated it last?

If so, then your design can just be this without the need for a pivot table:

Customers
-----------
id
name
Packages
-----------
id
name
created_by (customer_id)
updated_by (customer_id)

However, if you'd like to track all users that update a package, you could do something like this:

Customers
-----------
id
name
Packages
-----------
id
name
created_by (customer_id)
Pivot (tracking updates)
-----------
customer_id (primary key)
package_id (primary key)
updated_at (timestamp)
Last updated 7 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.