Exemple #1
0
 /**
  * Returns a fieldset instance.
  *
  * @param  mixed  $id
  * @param  \Closure  $callback
  * @return \Illuminate\Support\Collection
  */
 public function fieldset($id, Closure $callback = null)
 {
     if (!($fieldset = $this->find($id))) {
         $this->put($id, $fieldset = new Fieldset($id));
     }
     $fieldset->executeCallback($callback);
     return $fieldset;
 }
Exemple #2
0
 /** @test */
 public function it_can_attach_a_field_to_the_fieldset()
 {
     $this->assertCount(0, $this->fieldset);
     $this->fieldset->attach(new Field('foo'));
     $this->fieldset->attach(new Field('bar'));
     $this->fieldset->attach(new Field('baz'));
     $this->fieldset->attach(new Field('foo'));
     $this->fieldset->attach(new Fieldset('foo'));
     $this->assertCount(3, $this->fieldset);
 }