-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathDATABASE-SCHEMA.php
64 lines (54 loc) · 1.71 KB
/
DATABASE-SCHEMA.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
///////////////////////////////////////////////
///////////////////////////////////////////////
- TyreModels (ex: Michelin, Continental)
->id
->name
- TyreTypes (ex: letni, zimni)
->id
->name
- TyreSizes (ex: 195 65 15)
->id
->value
///////////////////////////////////////////////
//////////////////////////////////////////////
Customers =====> Created Customer model, migration and resource controller
->id
->name
->date_of_birth(for a person) / EDB(for a company)
->adress
->city
->country
->email_address
->phone_number
Products (combination of model,type and size) =====> Created Product model, migration and resource controller
->id
->model
->type
->size
->year (the year when the tyre was manufactured)
->description
->quantity
->purchase_price
->sale_price
Sales =======>database was seeded with faker values
->id
->customer_id
->product_id
->quantity
->total_price (quantity * unit_price)
->payment_due
->is_paid(boolean value = true or false)
Payments =======>database was seeded with faker values
->id
->sale_id
->description
->amount
////////////////////////////////////
////RELATIONSHIPS BETWEEN MODELS////
////////////////////////////////////
Customer model is related to the Sale model with a hasMany relationship.
Product model is related to the Sale model with a hasMany relationship. The
Sale model is related to the Customer and Product model wit belongsTo relationship.
Payment model --> belongsTo <-- Sale model relationship.
Sale model --> hasMany <-- Payment model relationship.
Customer model hasManyThrough relationship with Payment::model