2015-07-13 03:01:42 +08:00
|
|
|
<?php
|
|
|
|
|
2024-03-17 23:29:09 +08:00
|
|
|
use Carbon\Carbon;
|
2015-07-13 03:01:42 +08:00
|
|
|
use Illuminate\Database\Migrations\Migration;
|
2021-06-26 23:23:15 +08:00
|
|
|
use Illuminate\Database\Schema\Blueprint;
|
2024-03-17 23:29:09 +08:00
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
use Illuminate\Support\Facades\Schema;
|
2015-07-13 03:01:42 +08:00
|
|
|
|
2023-02-07 00:58:29 +08:00
|
|
|
return new class extends Migration
|
2015-07-13 03:01:42 +08:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Run the migrations.
|
|
|
|
*/
|
2024-03-17 23:29:09 +08:00
|
|
|
public function up(): void
|
2015-07-13 03:01:42 +08:00
|
|
|
{
|
|
|
|
Schema::create('users', function (Blueprint $table) {
|
|
|
|
$table->increments('id');
|
|
|
|
$table->string('name');
|
|
|
|
$table->string('email')->unique();
|
|
|
|
$table->string('password', 60);
|
|
|
|
$table->rememberToken();
|
2016-02-17 05:25:11 +08:00
|
|
|
$table->nullableTimestamps();
|
2015-07-13 03:01:42 +08:00
|
|
|
});
|
2015-08-29 22:03:42 +08:00
|
|
|
|
2016-05-02 04:20:50 +08:00
|
|
|
// Create the initial admin user
|
|
|
|
DB::table('users')->insert([
|
2021-06-26 23:23:15 +08:00
|
|
|
'name' => 'Admin',
|
|
|
|
'email' => 'admin@admin.com',
|
|
|
|
'password' => bcrypt('password'),
|
2024-03-17 23:29:09 +08:00
|
|
|
'created_at' => Carbon::now()->toDateTimeString(),
|
|
|
|
'updated_at' => Carbon::now()->toDateTimeString(),
|
2015-08-29 22:03:42 +08:00
|
|
|
]);
|
2015-07-13 03:01:42 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reverse the migrations.
|
|
|
|
*/
|
2024-03-17 23:29:09 +08:00
|
|
|
public function down(): void
|
2015-07-13 03:01:42 +08:00
|
|
|
{
|
|
|
|
Schema::drop('users');
|
|
|
|
}
|
2023-02-07 00:58:29 +08:00
|
|
|
};
|