public function index($options = ['team' => false, 'owner' => null, 'org' => null, 'name' => null])
{
$this->sites()->fetch(['org_id' => isset($options['org']) ? $options['org'] : null, 'team_only' => isset($options['team']) ? $options['team'] : false]);
if (isset($options['name']) && !is_null($name = $options['name'])) {
$this->sites->filterByName($name);
}
if (isset($options['owner']) && !is_null($owner = $options['owner'])) {
if ($owner == 'me') {
$owner = $this->session()->getUser()->id;
}
$this->sites->filterByOwner($owner);
}
$sites = array_map(function ($site) {
return $site->serialize();
}, $this->sites->all());
if (empty($sites)) {
$this->log()->notice('You have no sites.');
}
return new RowsOfFields($sites);
}