Files
izyim/database/migrations/2018_09_07_073209_create_user_table.php
T
2019-02-14 14:36:45 +08:00

67 lines
1.9 KiB
PHP

<?php
use App\Classes\ValueObjects\Constants\UserRoles;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateUserTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up(): void {
$faker = \Faker\Factory::create();
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->string('first_name', 60);
$table->string('last_name', 60);
$table->string('email')->unique();
$table->string('password');
$table->integer('verified')->nullable()->default(0);
$table->integer('role_id');
$table->rememberToken();
$table->timestamps();
});
DB::table('users')->insert(
[
'first_name' => 'Omair',
'last_name' => 'Saleh',
'email' => 'omair@izyim.com',
'password' => Hash::make('123456abcabc'),
'verified' => 1,
'role_id' => UserRoles::SUPER_ADMIN,
'created_at' => \Carbon\Carbon::now(),
'updated_at' => \Carbon\Carbon::now()
],
[
'first_name' => 'Development',
'last_name' => 'User',
'email' => env('EMAIL_DEVELOPMENT', 'dev@izyim.com'),
'password' => Hash::make('123456abcabc'),
'verified' => 1,
'role_id' => UserRoles::ADMIN,
'created_at' => \Carbon\Carbon::now(),
'updated_at' => \Carbon\Carbon::now()
]
);
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('user');
}
}