/** * Handle the command. * * @param TypeRepositoryInterface $types * @param PageRepositoryInterface $pages */ public function handle(TypeRepositoryInterface $types, PageRepositoryInterface $pages) { /* @var TypeInterface $type */ $type = $types->find($this->type->getId()); /* @var PageInterface $page */ foreach ($type->getPages() as $page) { $pages->save($page->setAttribute('entry_type', $this->type->getEntryModelName())); } }
/** * Handle the command. * * @param StreamRepositoryInterface $streams * @param TypeRepositoryInterface $types * @param Repository $config */ public function handle(StreamRepositoryInterface $streams, TypeRepositoryInterface $types, Repository $config) { /* @var TypeInterface $type */ $type = $types->find($this->type->getId()); /* @var StreamInterface $stream */ $stream = $type->getEntryStream(); $stream->fill([$config->get('app.fallback_locale') => ['name' => $this->type->getName(), 'description' => $this->type->getDescription()], 'slug' => $this->type->getSlug() . '_pages']); $streams->save($stream); }