-
app/Repositories/LinkRepository.php
Open in GitHubclass LinkRepository { // protected static function processTaxonomy(string $model, array $entries): Collection { $newEntries = collect(); foreach ($entries as $entry) { if (is_int($entry)) { $newEntry = Tag::find($entry); } else { $newEntry = $model::firstOrCreate([ 'user_id' => auth()->id(), 'name' => trim($entry), ]); } if ($newEntry !== null) { $newEntries->push($newEntry->id); } } return $newEntries; } }