class User{
function getRankAttribute(){
if($this->points == 0){
return new Rank(['name' = 'лох', 'color' => 'pink', 'score' => 0]);
}
$ranks = cache()->remember('ranks', Carbon::now()->addHour(), function (){
return Rank::orderBy('score', 'desc')->get();
});
return $ranks->filter(function ($item, $key) {
return $item->score <= $this->points;
})->first();
}
}
class User{
function getRankAttribute(){
$ranks = cache()->remember('ranks', Carbon::now()->addHour(), function (){
return Rank::orderBy('score', 'desc')->get();
});
return $ranks->filter(function ($item, $key) {
return $item->score <= $this->points;
})->first();
}
}
add_header 'Access-Control-Allow-Origin' '*';
add_header "Access-Control-Allow-Methods" "GET, POST, OPTIONS, HEAD";
add_header "Access-Control-Allow-Headers" "Authorization, Origin, X-Requested-With, Content-Type, Accept";
| 2023-01-06 | -100 |
| 2023-01-07 | -100 |
| 2023-01-08 | -100 |