/**
  * Handle the command.
  *
  * @param StreamRepositoryInterface $streams
  */
 public function handle(StreamRepositoryInterface $streams)
 {
     if (!$this->type->isForceDeleting()) {
         return;
     }
     $streams->delete($streams->findBySlugAndNamespace($this->type->getSlug() . '_posts', 'posts'));
 }
Example #2
0
 /**
  * Handle the command.
  *
  * @param TypeRepositoryInterface $types
  * @param PostRepositoryInterface $posts
  */
 public function handle(TypeRepositoryInterface $types, PostRepositoryInterface $posts)
 {
     /* @var TypeInterface $type */
     $type = $types->find($this->type->getId());
     /* @var PostInterface $post */
     foreach ($type->getPosts() as $post) {
         $posts->save($post->setAttribute('entry_type', $this->type->getEntryModelName()));
     }
 }
Example #3
0
 /**
  * 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() . '_posts']);
     $streams->save($stream);
 }
Example #4
0
 /**
  * Find many posts by type.
  *
  * @param TypeInterface $type
  * @param null          $limit
  * @return PostCollection
  */
 public function findManyByType(TypeInterface $type, $limit = null)
 {
     return $this->model->live()->where('type_id', $type->getId())->paginate($limit);
 }
 /**
  * Handle the command.
  *
  * @param BreadcrumbCollection $breadcrumbs
  */
 public function handle(BreadcrumbCollection $breadcrumbs)
 {
     $breadcrumbs->add($this->type->getName(), $this->dispatch(new GetTypePath($this->type)));
 }
Example #6
0
 /**
  * Handle the command.
  *
  * @param SettingRepositoryInterface $settings
  * @return string
  */
 public function handle(SettingRepositoryInterface $settings)
 {
     return $settings->value('anomaly.module.posts::module_segment', 'posts') . '/' . $this->category->getSlug();
 }
Example #7
0
 /**
  * Handle the command.
  *
  * @param ViewTemplate $template
  */
 public function handle(ViewTemplate $template)
 {
     $template->set('meta_title', $this->type->getName());
 }
 /**
  * Handle the command.
  *
  * @param StreamRepositoryInterface $streams
  * @return \Anomaly\Streams\Platform\Stream\Contract\StreamInterface|null
  */
 public function handle(StreamRepositoryInterface $streams)
 {
     return $streams->findBySlugAndNamespace($this->type->getSlug() . '_posts', 'posts');
 }
Example #9
0
 /**
  * Handle the command.
  *
  * @param Repository $config
  * @return string
  */
 public function handle(Repository $config)
 {
     return $config->get('anomaly.module.posts::paths.module') . '/' . $this->category->getSlug();
 }
Example #10
0
 /**
  * Handle the command.
  *
  * @param PostRepositoryInterface $posts
  */
 public function handle(PostRepositoryInterface $posts)
 {
     foreach ($this->type->getPosts() as $post) {
         $posts->delete($post);
     }
 }
Example #11
0
 /**
  * @param StreamRepositoryInterface $streams
  * @param Repository                $config
  */
 public function handle(StreamRepositoryInterface $streams, Repository $config)
 {
     $streams->create([$config->get('app.fallback_locale') => ['name' => $this->type->getName(), 'description' => $this->type->getDescription()], 'namespace' => 'posts', 'slug' => $this->type->getSlug() . '_posts', 'translatable' => true, 'locked' => false]);
 }