the purpose of this page is to show you how to add a column in the users table to allow to distinguish between a regular user and an admin user.

$ php artisan make:migration add_type_to_users_table

$ code database/migrations/*add_type_to_users_table.php

*add_type_to_users_table.php

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::table('users', function (Blueprint $table) {
            $table->string('type')->default('user'); //user or admin
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('users', function (Blueprint $table) {
            $table->dropColumn('type');
        });
    }
};

 

$ php artisan migrate