本文整理汇总了PHP中app\Notification::stream方法的典型用法代码示例。如果您正苦于以下问题:PHP Notification::stream方法的具体用法?PHP Notification::stream怎么用?PHP Notification::stream使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Notification
的用法示例。
在下文中一共展示了Notification::stream方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: indexGlobal
/**
* @return $this
*/
public function indexGlobal()
{
$notifications = Notification::stream()->latest()->paginate(20);
return view('notifications.global')->with('notifications', $notifications)->with('header', 'Global Notifications');
}
示例2: getIndex
//.........这里部分代码省略.........
Cache::put('pastyear_bestKillStreak', $PastYear->bestKillStreak, 720);
}
//Past Year bestDeathStreak
if (Cache::has('pastyear_bestDeathStreak')) {
$PastYear->bestDeathStreak = Cache::get('pastyear_bestDeathStreak');
} else {
$PastYear->bestDeathStreak = $player->getBestIn('MAX(death_streak) as best_death_streak', 'best_death_streak', $pastYearDate);
Cache::put('pastyear_bestDeathStreak', $PastYear->bestDeathStreak, 720);
}
//Past Year totalTeamKills
if (Cache::has('pastyear_totalTeamKills')) {
$PastYear->totalTeamKills = Cache::get('pastyear_totalTeamKills');
} else {
$PastYear->totalTeamKills = $player->getBestIn('SUM(team_kills) as totalteamkills', 'totalteamkills', $pastYearDate);
Cache::put('pastyear_totalTeamKills', $PastYear->totalTeamKills, 720);
}
//Past Year totalTimePlayed
if (Cache::has('pastyear_totalTimePlayed')) {
$PastYear->totalTimePlayed = Cache::get('pastyear_totalTimePlayed');
} else {
$PastYear->totalTimePlayed = $player->getBestIn('SUM(time_played) as totaltimeplayed', 'totaltimeplayed', $pastYearDate);
Cache::put('pastyear_totalTimePlayed', $PastYear->totalTimePlayed, 720);
}
//Past Year bestScorePerMin
if (Cache::has('pastyear_bestScorePerMin')) {
$PastYear->bestScorePerMin = Cache::get('pastyear_bestScorePerMin');
} else {
$PastYear->bestScorePerMin = $player->getBestIn('SUM(score)/SUM(time_played)*60 as scorepermin', 'scorepermin', $pastYearDate);
Cache::put('pastyear_bestScorePerMin', $PastYear->bestScorePerMin, 720);
}
} else {
$AllTime->totalScore = 0;
$AllTime->highestScore = 0;
$AllTime->totalArrests = 0;
$AllTime->totalArrested = 0;
$AllTime->totalKills = 0;
$AllTime->totalDeaths = 0;
$AllTime->bestArrestStreak = 0;
$AllTime->bestKillStreak = 0;
$AllTime->bestDeathStreak = 0;
$AllTime->totalTeamKills = 0;
$AllTime->totalTimePlayed = 0;
$AllTime->bestScorePerMin = 0;
$pastWeekDate = \Carbon\Carbon::now()->subWeek(1);
$PastWeek->totalScore = 0;
$PastWeek->highestScore = 0;
$PastWeek->totalArrests = 0;
$PastWeek->totalArrested = 0;
$PastWeek->totalKills = 0;
$PastWeek->totalDeaths = 0;
$PastWeek->bestArrestStreak = 0;
$PastWeek->bestKillStreak = 0;
$PastWeek->bestDeathStreak = 0;
$PastWeek->totalTeamKills = 0;
$PastWeek->totalTimePlayed = 0;
$PastWeek->bestScorePerMin = 0;
$pastMonthDate = \Carbon\Carbon::now()->subMonth(1);
$PastMonth->totalScore = 0;
$PastMonth->highestScore = 0;
$PastMonth->totalArrests = 0;
$PastMonth->totalArrested = 0;
$PastMonth->totalKills = 0;
$PastMonth->totalDeaths = 0;
$PastMonth->bestArrestStreak = 0;
$PastMonth->bestKillStreak = 0;
$PastMonth->bestDeathStreak = 0;
$PastMonth->totalTeamKills = 0;
$PastMonth->totalTimePlayed = 0;
$PastMonth->bestScorePerMin = 0;
$pastYearDate = \Carbon\Carbon::now()->subYear(1);
$PastYear->totalScore = 0;
$PastYear->highestScore = 0;
$PastYear->totalArrests = 0;
$PastYear->totalArrested = 0;
$PastYear->totalKills = 0;
$PastYear->totalDeaths = 0;
$PastYear->bestArrestStreak = 0;
$PastYear->bestKillStreak = 0;
$PastYear->bestDeathStreak = 0;
$PastYear->totalTeamKills = 0;
$PastYear->totalTimePlayed = 0;
$PastYear->bestScorePerMin = 0;
}
if ($PastYear->totalScore == null) {
$PastYear = $AllTime;
}
if ($PastMonth->totalScore == null) {
$PastMonth = $PastYear;
}
if ($PastWeek->totalScore == null) {
$PastWeek = $PastMonth;
}
//Latest Feeds
//$feeds = Status::with('user')->latest()->limit(5)->get();
$notifications = Notification::stream()->latest()->limit(5)->get();
$activeUsers = User::orderBy('updated_at', 'DESC')->limit(50)->get();
$bans = Ban::orderBy('updated_at', 'desc')->limit(5)->get();
$array = ['topPlayers' => $topPlayers, 'latestGames' => $latestGames, 'AllTime' => $AllTime, 'PastWeek' => $PastWeek, 'PastMonth' => $PastMonth, 'PastYear' => $PastYear, 'bans' => $bans, 'notifications' => $notifications, 'activeUsers' => $activeUsers, 'show_donation' => $show_donation, 'show_add' => $show_add];
return view('home', $array);
}