# BattleLog

## BattleLogList Object

### Retrieve a player's battle log

```
$battleLogs = $client->getPlayerBattleLog('player tag');
```

retrieving a battle log returns a BattleLogList Object. Any List object has special query function such as all(), first(), filter() etc. To find out more about the List query function visit the List page.&#x20;

The BattleLogList contains BattleLog Objects.&#x20;

### latest

return the latest battle log of the player. This returns a BattleLog Object

```
$battleLog = $battleLogs->latest();
```

## BattleLog

### battleTime

return the battle time of a battle

```
$battleTime = $battleLog->battleTime();
```

### battle

retrieve the battle from the battle log. This returns a Battle Object.&#x20;

```
$battle = $battleLog->battle()
```

### event

retrieve the event in which the battle occurred. This returns an Event object. To see the Event properties and methods refer to the Event page.

```
$battleEvent = $battleLog->event();
$battleMap = $battleLog->event()->map();
```

## Battle

Each battleLog contains a Battle Object

### mode&#x20;

returns the mode of the battle&#x20;

```
$battleMode = $battle->mode() // solo showdown
```

### result

returns the result of the battle

```
$battleResult = $battle->result()
```

### duration

return the duration of the battle in seconds

```
$battleDuration = $battle->duration() // 154
```

### trophy change

the amount of trophies gained or lost

```
$battleTrophies = $battle->trophyChange()
```

### star player

retrieves the star player of the battle. This returns a StarPlayer Object. To see the StarPlayer properties and methods refer to the StarPlayer page.

```
$starPlayer = $battle->starPlayer()
```

### teams

retrieves the teams that were battling. This returns a TeamsList Object. To see the TeamList properties refer to the TeamList page and the List page.

```
$teams = $battle->teams() // TeamList
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ahsan112.gitbook.io/brawlstars-php/documentation/battlelog.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
