Commit fc994321 authored by Jack Stupple's avatar Jack Stupple

tweak questions to be returned by language id

parent 505e0a11
......@@ -21,6 +21,11 @@ class Character extends Model
}
public function getAvailableQuestionsAttribute()
{
return $this->questions()->count();
}
public function questions()
{
$player = get_player($_SERVER['HTTP_SESSION_ID'], false);
......@@ -30,14 +35,8 @@ class Character extends Model
$language = \App\Language::where('slug', 'en')->first();
}
return $this->questions()
->where('language_id', $language->id)
->count();
}
public function questions()
{
return $this->hasMany(Question::class);
return $this->hasMany(Question::class)
->where('language_id', $language->id);
}
public function paperwork()
......
......@@ -19,6 +19,6 @@ class CharacterQuestionController extends Controller
'questions.options.modifiers',
'questions.options.modifiers.modifierCategory'
])
->where('language_id', $player->language_id)->firstOrFail()->questions;
->firstOrFail()->questions;
}
}
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