protected function commit_urls() { if ($this->urls) { $this->artist_urls->each('destroy'); foreach (array_unique(array_filter(preg_split('/\\v/', $this->urls))) as $url) { ArtistUrl::create(array('url' => $url, 'artist_id' => $this->id)); } } }
<table class="form" style="margin-bottom: 1em;"> <tbody> <?php foreach ($this->artist->artist_urls as $artist_url) { ?> <tr> <th>URL</th> <td> <?php echo $this->linkTo($artist_url->url, $artist_url->url); ?> <?php if (current_user()->is_mod_or_higher()) { ?> (<?php echo $this->linkTo("mass edit", ['controller' => "tag", 'action' => "mass_edit", 'source' => "-" . $this->artist->name . " source:" . ArtistUrl::normalize_for_search($artist_url->url), 'name' => $this->artist->name]); ?> ) <?php } ?> </td> </tr> <?php } ?> <?php if ($this->artist->alias_id) { ?> <tr> <th>Alias for</th>