Is there anyway to use variables in eloquent Example:
public function showLessons($skill)
{
$user = (\App\User::where('id', Auth::user()->getId())->first());
$type = $user->type;
if ($type === "student") {
$bs = ($user->student_bronze_ . $skill);
$ss = ($user->student_silver_ . $skill);
$gs = ($user->student_gold_ . $skill);
} elseif ($type === "school") {
$bs = ($user->school_bronze_ . $skill);
$ss = ($user->school_silver_ . $skill);
$gs = ($user->school_gold_ . $skill);
};
return view('pages.lessons', compact("bs", "ss", "gs"));
}
I am trying to check if the user's level is the same or higher than the lesson's id