Exemplo n.º 1
0
 /**
  * Install the component.
  *
  * @return void
  */
 public function install()
 {
     Component::make('pages', function (Blueprint $component) {
         $component->string('title');
         $component->text('content');
         $component->datetime('published_at');
     });
 }
Exemplo n.º 2
0
 /**
  * Create a new component/table.
  *
  * @param  string  $name
  * @param  Closure  $schema
  * @return void
  */
 protected function createComponent(string $name, Closure $schema = null)
 {
     if (!$schema) {
         $schema = function () {
         };
     }
     ComponentBuilder::make($name, $schema);
 }
Exemplo n.º 3
0
 /** @test **/
 public function it_creates_a_new_component_and_fields()
 {
     Component::make('pages', function ($component) {
         $component->string('title');
         $component->text('content');
     });
     $this->seeInDatabase('components', ['name' => 'pages']);
     $this->seeInDatabase('fields', ['name' => 'title']);
     $this->seeInDatabase('fields', ['name' => 'content']);
 }