Example #1
0
 /**
  * Register and return the new taxonomy.
  *
  * @throws InvalidTaxonomyNameException
  *
  * @return Taxonomy
  */
 public function register()
 {
     if (!$this->id || strlen($this->id) > 32) {
         throw new InvalidTaxonomyNameException('Taxonomy names must be between 1 and 32 characters in length.');
     }
     register_taxonomy($this->id, $this->objectTypes, $this->assembleArgs());
     return Taxonomy::load($this->id);
 }
Example #2
0
 /**
  * @test
  */
 public function it_returns_a_new_builder_for_its_taxonomy_if_not_registered_yet()
 {
     $this->assertInstanceOf(Builder::class, Taxonomy::make('non_existent_tax'));
 }
Example #3
0
 /**
  * Get the Taxonomy model.
  *
  * @return Taxonomy|\Silk\Taxonomy\Builder
  */
 public static function taxonomy()
 {
     return Taxonomy::make(static::TAXONOMY);
 }