'channel', 'public' => true, 'internal' => $config['internal'] ?? false, ]), ); $createdChannels[] = [ 'parent' => $channel, 'nestedChannelSlugs' => $nestedChannelSlugs, ]; } foreach ($createdChannels as $createdChannel) { if (isset($createdChannel['nestedChannelSlugs'])) { foreach ($createdChannel['nestedChannelSlugs'] as $slug) { $nestedChannel = Channel::where('slug', $slug)->first(); $createdChannel['parent'] ->channels() ->attach($nestedChannel->id); } } } $homeChannel = Arr::first( $createdChannels, fn($c) => $c['parent']->slug === 'homepage', ); if (isset($homeChannel)) { return $homeChannel['parent']; } } } }