コード例 #1
0
 public function stats()
 {
     $yesterdaysBans = Cache::remember('bans.stats.yesterday', 120, function () {
         return Ban::yesterday()->count();
     });
     $avgBansPerDay = Cache::remember('bans.stats.average', 180, function () {
         $result = head(DB::select(File::get(storage_path() . '/sql/avgBansPerDay.sql')));
         return intval($result->total);
     });
     return MainHelper::response(['bans' => ['yesterday' => $yesterdaysBans, 'average' => $avgBansPerDay]], NULL, NULL, NULL, FALSE, TRUE);
 }
コード例 #2
0
ファイル: BanRepository.php プロジェクト: R3alflash/BFAdminCP
 /**
  * Gets a ban by their ID
  * @param  integer $id Ban ID
  * @return object
  */
 public function getBanById($id)
 {
     $ban = Ban::with('player', 'record')->findOrFail($id);
     return $ban;
 }
コード例 #3
0
ファイル: events.php プロジェクト: R3alflash/BFAdminCP
 if (is_null($player->ban)) {
     // Init a new ban entry
     $ban = new Ban();
     // Init a new record entry
     $record = new Record();
     // Set the player for the record
     $record->target_id = $player->PlayerID;
     $record->target_name = $player->SoldierName;
     // Assocate the player with the ban.
     $ban->player()->associate($player);
 } else {
     if ($ban instanceof BFACP\AdKats\Ban) {
         // Don't need too do anything else.
     } else {
         // Retrive the ban record from the database
         $ban = Ban::findOrFail($ban);
     }
     $oldRecord = $ban->record;
     // Replicate the old record entry
     $record = $ban->record->replicate();
     // Only modify the old record if the command action is a temp or perma ban.
     if (in_array($oldRecord->command_action, [7, 8])) {
         // 72 => Previous Temp Ban
         // 73 => Previous Perm Ban
         $oldRecord->command_action = $oldRecord->command_action == 8 ? 73 : 72;
     }
     // Save any changes made on the old record
     $oldRecord->save();
 }
 // Temp Ban
 if (array_get($input, 'ban_type') == 7) {