Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

iabrar95's avatar

User Roles and tables connections

Hello I have a project that contain a doctor and a patient i have already made the authentication and when the doctors login the redirect to dashboard which is different than the patient dashboard

public function up() { Schema::create('users', function (Blueprint $table) { $table->id(); $table->string('name');

        $table->boolean('isDoctor')->default(0); >>>> here i differentiate between the doctor and patient

        $table->string('email')->unique();
        $table->timestamp('email_verified_at')->nullable();
        $table->string('password');
        $table->rememberToken();
        $table->timestamps();
    });
}

but their information is stored in the same table which is user table. i want to make a doctor table and other patient table what is the relationship that i can connect the information of the doctor in the user table to the new doctor table ???

0 likes
1 reply
Tray2's avatar

Either you create a roles table where you store the id from the user together with a role id where the role id determines if the user is a doctor or patient or you can just create a doctors table where you store the ids of the doctors. If the id is not in the doctors table it's a patient.

1 like

Please or to participate in this conversation.