33 lines
770 B
PHP
33 lines
770 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\DB;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
return new class extends Migration
|
|
{
|
|
public function up(): void
|
|
{
|
|
Schema::create('roles', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->string('name')->unique();
|
|
$table->timestamps();
|
|
});
|
|
|
|
$now = now();
|
|
|
|
DB::table('roles')->insert([
|
|
['name' => 'user', 'created_at' => $now, 'updated_at' => $now],
|
|
['name' => 'admin', 'created_at' => $now, 'updated_at' => $now],
|
|
]);
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('roles');
|
|
}
|
|
};
|