Created
April 27, 2019 07:45
-
-
Save earth774/68becfce4bd95f9573f7ee32b19914e5 to your computer and use it in GitHub Desktop.
create insert database
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Illuminate\Database\Migrations\Migration; | |
use Illuminate\Database\Schema\Blueprint; | |
use Illuminate\Support\Facades\Schema; | |
class CreateUsersTable extends Migration | |
{ | |
/** | |
* Run the migrations. | |
* | |
* @return void | |
*/ | |
public function up() | |
{ | |
Schema::create('users', function (Blueprint $table) { | |
$table->bigIncrements('id'); | |
$table->string('fullname'); | |
$table->string('lastname'); | |
$table->string('age'); | |
$table->string('tel'); | |
$table->timestamps(); | |
}); | |
// User table | |
DB::table('users')->insert( | |
[[ | |
'fullname' => 'สุทธิพงศ์', | |
'lastname' => 'นวลมะ', | |
'age' => '24', | |
'tel' => '088 323 4312', | |
'created_at' => date('Y-m-d H:i:s'), | |
'updated_at' => date('Y-m-d H:i:s'), | |
]] | |
); | |
} | |
/** | |
* Reverse the migrations. | |
* | |
* @return void | |
*/ | |
public function down() | |
{ | |
Schema::dropIfExists('users'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment