Sleimanx2\Plastic\Map\Blueprint::string PHP Method

string() public method

Add a string field to the map.
public string ( string $field, array $attributes = [] ) : Illuminate\Support\Fluent
$field string
$attributes array
return Illuminate\Support\Fluent
    public function string($field, $attributes = [])
    {
        return $this->addField('string', $field, $attributes);
    }

Usage Example

Example #1
0
 /**
  * @test
  */
 public function it_adds_a_object_map()
 {
     $blueprint = new Blueprint('post');
     $blueprint->create();
     $blueprint->object('tags', function ($blueprint) {
         $blueprint->string('name');
     });
     $statement = $blueprint->toDSL($this->getGrammar());
     $this->assertEquals(['tags' => ['properties' => ['name' => ['type' => 'string']]]], $statement);
 }