コード例 #1
0
ファイル: Repository.php プロジェクト: sohailaammarocs/lfc
 /**
  * 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;
 }
コード例 #2
0
ファイル: FormTest.php プロジェクト: sohailaammarocs/lfc
 /** @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);
 }