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

Hello Roelof,

Could you please tell the attributes that you need for customers and attributes that need to have volunteers?

Pedro

Last updated 2 years ago.
0

Hello Roelof,

If you don't want to duplicate info then you should have 3 tables:

persons table:

  • id
  • name
  • address
  • city
  • ....

volunteers table:

  • id
  • person_id (foreign key)
  • login
  • password

customers table:

  • id
  • person_id (foreign key)
  • customer_number

This is the common solution normalizing

Best Regards, Pedro

Last updated 2 years ago.
0

Personally if you're new to this, I'd steer away from all those tables and simply have a couple of flags in the users table like "is_volunteer" and "is_customer" or even better assign roles to users - but that might be going too far with your current understanding.

That way if a volunteer ever becomes a customer, or vice versa, you just set the relevant flags.

As Pedro says though, normalization is the accepted practice and I'd certainly look at creating a separate "address" table, not sure I'd go so far as separate users tables though.

Last updated 2 years ago.
0

Thanks everybody,

That is also a problem I have to adress. Take care that roles are executed. But first things, first, making that volunteers can log in.

Roelof

Last updated 2 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.