/** * 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(); }
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; }
/** * @return array */ public function getTypeOptions() { return TagType::toArray(); }
public function scopeWithType($query, TagType $type) { return $query->nonDraft()->where('type', $type->getValue()); }
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')); }