/** * Install the component. * * @return void */ public function install() { Component::make('pages', function (Blueprint $component) { $component->string('title'); $component->text('content'); $component->datetime('published_at'); }); }
/** * 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); }
/** @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']); }