I'm trying to get the values from a values table, replace them in the formulas table and consequently show these results in my view. My question is how can I get these values and replace them in the formula table in my Controller. I've done some research and read some things in the documentation, but with no success and no idea how I might be doing this.
For example:
Values Table = {"id": 1, "$ph_smp": 1.22, "$ph_kcl": 2.36}
Formula Table = {"id": 1, "$ph_smp": number_format((1.371+(0.868*$ph_kcl)), 2, \",\", \"\"), "$ph_kcl": number_format(($ph_kcl)), 2, \",\", \"\")}
And do as follows:
Formula Table = {"id": 1, "$ph_smp": 3,15, "$ph_kcl": 2,36}
I don't want to update the formulas table, but just have this result to be used in the view temporarily. Even because I will always need to use the formulas table to generate other results, depending on what is in the values table.
In other programming languages when you have, for example, y = x**2 + 2x and we need to print the result of y for a certain value is quite simple. But in Laravel I can't imagine how it would be done, because it's about values and formulas contained in tables.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire