Question: You think session is faster than Auth?

Asked By
amitoz.deol
Asked At
2018-04-11 14:32:52

Found 15 possible answers.

User Answered At Possible Answer
marlinf 2018-04-11 14:33:01 No, better suited to what you're trying to do
xtremer360 2018-04-11 14:33:07 Somehow from the following method I am getting this value returned. 3.6379788070917E-12
public function calculateBalanceOwed()
    }
return $this->contract_amount + $this->supplement_amount - $paid; $paid = $this->payments()->sum('amount'); {
marlinf 2018-04-11 14:33:21 float arithmetic is not precise
temp1029 2018-04-11 14:33:49 Tl;dr, nothing is broken and the new way is more secure but it annoys me I don’t understand why it’s fixed... :face_with_rolling_eyes:
xtremer360 2018-04-11 14:34:04 Is there an alternative.
marlinf 2018-04-11 14:34:26 @stephen.gobin it's a gift, take it you can learn next time, when you have time :stuck_out_tongue:
temp1029 2018-04-11 14:35:29 @marlinf True story, lol
marlinf 2018-04-11 14:35:38 @xtremer360 always round results of arithmetic operations assuming those are currency values https://stackoverflow.com/a/3726761/401467 or store integers and divide by 100 when you display
xtremer360 2018-04-11 14:37:33 They are.
marlinf 2018-04-11 14:38:07 depending how far you are into the project, it's better to store integers integer arithmetic is 100% precise
xtremer360 2018-04-11 14:40:08 Right.
sisve 2018-04-11 14:40:52 Yolo!
amitoz.deol 2018-04-11 14:44:13 @marlinf object_get(Auth::user(), 'xyz') returning null. I don't think it's saving my new variable into a session. Everything else is saved
marlinf 2018-04-11 14:47:09 open debugbar, and check the queries, you might see that it queries the user every request, for security. not on the user model but also, you can just save that value into session yourself. if so, toughies
xtremer360 2018-04-11 14:48:21 @marlinf Does it make a difference if they were stored as Double instead of Float

Related Questions