<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateRolesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('roles', function (Blueprint $table) {
            $table->id();
            $table->string('name');
            $table->string('type');
            $table->string('details')->nullable();
            $table->timestamps();
        });


        DB::table('roles')->insert([
            [
                'name' => 'Super admin',
                'type' => 'System',
                'created_at' => date('Y-m-d h:i:s')
            ],
            [
                'name' => 'Instructor',
                'type' => 'System',
                'created_at' => date('Y-m-d h:i:s')
            ],
            [
                'name' => 'Student',
                'type' => 'System',
                'created_at' => date('Y-m-d h:i:s')
            ]
        ]);
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('roles');
    }
}
