Ejemplo n.º 1
0
 /**
  *  Get an array with all possible types.
  */
 public function allTagTypes()
 {
     $tagTypes = [];
     foreach (TagType::values() as $value) {
         $tagTypes[(string) $value] = trans("back-tags.types.{$value}");
     }
     return collect($tagTypes)->sort();
 }
Ejemplo n.º 2
0
 public function seedRandomTags($amount = 10)
 {
     $tags = new Collection();
     for ($i = 0; $i < $amount; ++$i) {
         $tag = Tag::findByNameOrCreate($this->faker->words(2, true), TagType::NEWS_TAG());
         $tags->add($tag);
     }
     return $tags;
 }
Ejemplo n.º 3
0
 /**
  * @return array
  */
 public function getTypeOptions()
 {
     return TagType::toArray();
 }
Ejemplo n.º 4
0
 public function scopeWithType($query, TagType $type)
 {
     return $query->nonDraft()->where('type', $type->getValue());
 }
Ejemplo n.º 5
0
 public function update()
 {
     parent::update();
     $this->updateTags(TagType::NEWS_TAG(), TagType::NEWS_CATEGORY());
     $this->model->publish_date = Carbon::createFromFormat('d/m/Y', $this->request->get('publish_date'));
 }