vendredi 29 décembre 2017

Best way to create relational database model for different Customer modals in Laravel

In my Laravel project there are Vehicle Owner, Driver and Customer models. There is default laravel user table also for auth. Each of them is separate tables in database. Now I'm adding credits and debts for all of them. It's working but I'm not happy with solution because:

  1. There are several common fields repeating in each.
  2. When user will add credit/invoice I'm joining 3 tables.
  3. Financial table seems more complex

Finance

  userType       | userID       | amouth       
  ------         |  ------      |----------- 
  VehicleOwner   |  5           | -500
  Driver         |  5           |  200
  Customer       |  5           |  200

Maybe one solution could be relate all 3 tables with one human table:

Human All Basic User Info will be related every human being. Extend it:

1.Driver (extend driving license info)
2.Customer (extend corporate info)
3.Vehicle Owner (extend driver info)

I'm new in Laravel and looking for best practice?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire