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

object() public method

Add a object map.
public object ( $field, Closure $callback ) : Illuminate\Support\Fluent
$field
$callback Closure
return Illuminate\Support\Fluent
    public function object($field, Closure $callback)
    {
        return $this->addField('object', $field, ['callback' => $callback]);
    }

Usage Example

Esempio n. 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);
 }