Commit 2c09c5a6 authored by Jack Stupple's avatar Jack Stupple

tweak to the logic (sorry, wrking on stage)

parent 4abce408
......@@ -19,11 +19,11 @@ class Answer extends Model
public function modifiers()
{
$selected_currency = Player::select('currency_id')->where('session_id', '=', $_SERVER['HTTP_SESSION_ID'])->first();
if ($selected_currency) {
$player = Player::where('session_id', '=', $_SERVER['HTTP_SESSION_ID'])->first();
if ($player->currency_id) {
return $this->hasMany(\App\Modifier::class, 'model_id')
->where('model', '=', 'answer')
->where('currency_id', '=', $selected_currency->id);
->where('currency_id', '=', $player->currency_id);
} else {
$default_currency = Currency::where('currency_code', 'EUR')->firstOrFail();
return $this->hasMany(\App\Modifier::class, 'model_id')
......
......@@ -17,12 +17,12 @@ class Character extends Model
public function baseModifiers()
{
$selected_currency = Player::select('currency_id')->where('session_id', '=', $_SERVER['HTTP_SESSION_ID'])->first();
$player = Player::where('session_id', '=', $_SERVER['HTTP_SESSION_ID'])->first();
if ($selected_currency) {
if ($player->currency_id) {
return $this->hasMany(Modifier::class, 'model_id')
->where('model', '=', 'character')
->where('currency_id', '=', $selected_currency->id);
->where('currency_id', '=', $player->currency_id);
} else {
$default_currency = Currency::where('currency_code', 'EUR')->firstOrFail();
return $this->hasMany(Modifier::class, 'model_id')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment