Refactor various services and models for improved type handling and configuration management
This commit is contained in:
@@ -125,7 +125,7 @@ class HelpdeskImportService
|
||||
continue;
|
||||
}
|
||||
|
||||
if (! $dryRun && $parentId !== null) {
|
||||
if (! $dryRun) {
|
||||
$childModel = Category::query()->updateOrCreate(
|
||||
['external_id' => (int) $child['id']],
|
||||
['name' => (string) $child['title'], 'slug' => (string) $child['slug'], 'parent_id' => $parentId]
|
||||
@@ -179,13 +179,15 @@ class HelpdeskImportService
|
||||
|
||||
foreach ($sources as $source) {
|
||||
try {
|
||||
$html = $source['html'] ?? $this->fetch($source['url']);
|
||||
$html = array_key_exists('html', $source)
|
||||
? (string) $source['html']
|
||||
: $this->fetch((string) $source['url']);
|
||||
} catch (\Throwable) {
|
||||
continue;
|
||||
}
|
||||
|
||||
preg_match_all('/https:\/\/www\.internettoday\.nl\/helpdesk\/(\d+)-[a-z0-9\-]+/i', $html, $matches);
|
||||
foreach (($matches[0] ?? []) as $match) {
|
||||
foreach ($matches[0] as $match) {
|
||||
$url = strtolower($match);
|
||||
if (! isset($result[$url])) {
|
||||
$result[$url] = [
|
||||
|
||||
Reference in New Issue
Block a user