Ejemplo n.º 1
0
 /**
  * Returns a form instance.
  *
  * @param  mixed  $id
  * @param  \Closure  $callback
  * @return \Illuminate\Support\Collection
  */
 public function form($id, Closure $callback = null)
 {
     if (!($form = $this->find($id))) {
         $this->put($id, $form = new Form($id));
     }
     $form->executeCallback($callback);
     return $form;
 }
Ejemplo n.º 2
0
 /** @test */
 public function it_can_attach_a_section_to_the_form()
 {
     $this->assertCount(0, $this->form);
     $this->form->attach(new Section('foo'));
     $this->form->attach(new Section('bar'));
     $this->form->attach(new Section('baz'));
     $this->form->attach(new Section('foo'));
     $this->form->attach(new Form('foo'));
     $this->assertCount(3, $this->form);
 }