I have the following tables:
Address
id,long,
latt,
address_1
postcode
Jobs
pickup (links to
idinAddress)dropoff (links to
idin theAddress)
Quotes
pickup (links to
idinAddress)dropoff (links to
idin theAddress)
Part of the functionality is to calculate the distance between the pickup and dropoff but the issue is that I'm currently calculating this functionality inside of the controllers for both the Jobs and of course the Quotes which is not very good because if the functionality changes or whatever, then this requires changing it in both ways. I want to be able to re-use the functionality.
The idea is that, if the pickup and dropoff is changed the Jobs table is changed then this would re-calculate the distance between the two locations. So essentially the Jobs and Quotes will be able to access the function calculateDistance($pickup, $dropoff)
Anyone suggest where I could store this so I'm not repeating and re-using code?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire