JavaScript
11
Вклад в тег
public function index(){
$history = History::where('id','>',0)->orderBy('id','desc')->limit(3)->get();
$lives = Tournaments::where('live',1)->where('status',1)->get();
$coming = Tournaments::where('live',0)->where('status',0)
->where('team1','!=','no team1')
->where('team2','!=','no team2')
->where('date','>=',Carbon::now()->timestamp)
->orderBy('date','ASC')
->take(10)
->get();
$latest = Tournaments::where('live',0)->where('status',0)->where('date','>=',Carbon::now()->timestamp)->orderBy('date','ASC')->first();
if($latest){
$last = Carbon::createFromTimestamp($latest->date)->toDateTimeString();
if(count($lives) == 0){
$c = 0;
}else{
$c = 1;
}
if(count($coming) == 0){
$pages = 1;
}else{
$pages = round(count($coming)/10);
}
}
var post = '';
for (var i=0; i < json.length; i++) {
post += "<div class=card border-dark mb-3><div class=card-header bg-transparent border-dark>" + json[i][0] + "</div><div class=card-body text-dark><h5 class=card-title>Стоимость " + json[i][1] + "</h5><h5 class=card-title>Скидка " + json[i][3] + "</h5><h5 class=card-title>Итог " + json[i][2] +"</h5></div><div class=card-footer bg-transparent border-dark>Обновлялось скидка " + json[i][4] +"</div><div>";
}
$("#post").html(post);