save to codehub
This commit is contained in:
37
app/Console/Commands/StepsCountPoint.php
Normal file
37
app/Console/Commands/StepsCountPoint.php
Normal file
@@ -0,0 +1,37 @@
|
||||
// <?php
|
||||
|
||||
// namespace App\Console\Commands;
|
||||
|
||||
// use Illuminate\Console\Command;
|
||||
// use App\Models\DailyStepsCount;
|
||||
// use App\Models\User;
|
||||
// use Carbon\Carbon;
|
||||
// use App\Models\LeaderboardMaster;
|
||||
|
||||
// class StepsCountPoint extends Command
|
||||
// {
|
||||
// protected $signature = 'steps:count';
|
||||
// protected $description = 'Calculate points based on daily step counts.';
|
||||
// public function handle()
|
||||
// {
|
||||
// $date = Carbon::now()->toDateString();
|
||||
// $dailyStepCount = DailyStepsCount::where('date',$date)->get();
|
||||
|
||||
// if($dailyStepCount){
|
||||
// foreach($dailyStepCount as $count){
|
||||
|
||||
// $steps = $count->step_count;
|
||||
// $points = intval(floor($steps/1000));
|
||||
// $user_id = $count->user_id;
|
||||
// $leaderboardMaster = LeaderboardMaster::where('user_id', $user_id)->first();
|
||||
// if ($leaderboardMaster) {
|
||||
|
||||
// $leaderboardMaster->total_score += $points;
|
||||
// $leaderboardMaster->save();
|
||||
// }
|
||||
|
||||
// }
|
||||
// $this->info('Points Added Successfully');
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
Reference in New Issue
Block a user