Skip to content

Instantly share code, notes, and snippets.

### Keybase proof
I hereby claim:
* I am drakonka on github.
* I am drakonka (https://keybase.io/drakonka) on keybase.
* I have a public key whose fingerprint is 6C12 115E B01B 0608 B4BB CC6B 50EA 6EE6 961B BA8B
To claim this, I am signing this object:
@lshulyay
lshulyay / Snail.php
Created July 25, 2014 18:52
Having an issue updating a record...it seems to be ignoring $propertiesToUpdate and trying to update properties that are set after model load and are NOT in the db. Error message: [2014-07-25 18:36:04] local.ERROR: exception 'Illuminate\Database\QueryException' with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column 'racePos' in 'fi…
<?php
function depleteEnergy($interval) {
Log::info('depleting snail energy. Snail ID: ' . $this->snailID);
// convert calories to Joules
// CurrentRMR is in JOULES
// Here we convert the target RMR (which is Joules to deplete PER HOUR) to Carbohydrates, Fat, and Protein. Then we multiply that by the Interval at which this job runs after converting it to hours.
$carbsToDeplete = Utility::JoulesToCarbs(Utility::CalcTargetPercentageValue($this->carbohydratesIdealPercentage, $this->currentRMR)) * Utility::SecondsToHours($interval);
$fatToDeplete = Utility::JoulesToFat(Utility::CalcTargetPercentageValue($this->fatIdealPercentage, $this->currentRMR)) * Utility::SecondsToHours($interval);