当前位置: 首页>>代码示例>>PHP>>正文


PHP Notification::stream方法代码示例

本文整理汇总了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');
 }
开发者ID:kinnngg,项目名称:knightofsorrow,代码行数:8,代码来源:NotificationController.php

示例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);
 }
开发者ID:kinnngg,项目名称:knightofsorrow,代码行数:101,代码来源:MainController.php


注:本文中的app\Notification::stream方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。