Sleimanx2\Plastic\Map\Blueprint::nested PHP Метод

nested() публичный Метод

Add a nested map.
public nested ( $field, Closure $callback ) : Illuminate\Support\Fluent
$field
$callback Closure
Результат Illuminate\Support\Fluent
    public function nested($field, Closure $callback)
    {
        return $this->addField('nested', $field, ['callback' => $callback]);
    }

Usage Example

Пример #1
0
 /**
  * @test
  */
 public function it_adds_a_nested_map()
 {
     $blueprint = new Blueprint('post');
     $blueprint->create();
     $blueprint->nested('tags', function ($blueprint) {
         $blueprint->string('name');
     });
     $statement = $blueprint->toDSL($this->getGrammar());
     $this->assertEquals(['tags' => ['type' => 'nested', 'properties' => ['name' => ['type' => 'string']]]], $statement);
 }