I have to trigger a mail when student crosses several stages . I have two tables
- studentreward_point_categories and
- student_reward_points.
If any student reaches a stage then need to send a mail. How to get category from db .
Reward point Category table.
- Student reward point table.
If for student_id = 19 have 345 points How to get his reward category. i have tried below code.
$total_point = StudentRewardPoint::where('student_id', $request->student_id)
->sum('points');
if(!empty($total_point)){
return $pointCategory = RewardPointCategory::where('from_value','>=', $total_point)
->where('to_value','<=',$total_point)
->where('status',1)
->first();
}
Using this query I'm not able to get user reward point category.
question from:
https://stackoverflow.com/questions/66064884/how-to-check-whether-a-number-lies-between-2-values-using-laravel-query 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…