/** * Returns the player record history * @param integer $id Player ID * @param integer $limit Results to return * @return object */ public function getPlayerRecords($id, $limit = 25) { $records = Record::with('target', 'source', 'type', 'action')->orderBy('record_time', 'desc')->whereNotIn('command_type', [48, 49, 85, 86])->where(function ($query) use($id) { $query->where('target_id', $id); $query->orWhere('source_id', $id); }); // If a command id is present we are going to only pull records // that have the specific id if (Input::has('cmdid')) { $cmdid = Input::get('cmdid', null); // Make sure the input is a number and greater than zero if (!is_null($cmdid) && is_numeric($cmdid) && $cmdid > 0) { $records->where(function ($query) use($cmdid) { $query->where('command_type', $cmdid); $query->orWhere('command_action', $cmdid); }); } } return $records->paginate($limit); }
/** * Get's a report by its ID * * @param integer $id * * @return object */ public function getReportById($id) { return Record::with('server', 'type', 'action')->whereIn('command_type', [18, 20])->findOrFail($id); }