Exemplo n.º 1
0
 public function createdb($dbname)
 {
     $prefix = 'laraapp_';
     $dbname = $prefix . $dbname;
     DB::statement('CREATE DATABASE IF NOT EXISTS ' . $dbname);
     configureConnectionByName($dbname, 'root', 'root');
     if (!Schema::hasTable('customer')) {
         Schema::create('customer', function ($t) {
             // auto increment id (primary key)
             $t->increments('id');
             $t->string('name');
             $t->integer('age')->nullable();
             $t->boolean('active')->default(1);
             $t->integer('role_id')->unsigned();
             $t->text('bio');
             // created_at, updated_at DATETIME
             $t->timestamps();
         });
     }
 }