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

beyondelayer's avatar

Creating a Model for Spatie Role?

Hello, everyone, and a happy new year. There is a subject that confuses me. I have different roles such as doctor, admin, user in Laravel. I want to handle doctors separately. For example, I want to fill the doctor_details table specifically for users who only have the doctor role, such as filling in the doctor_details table, getting the certificate, experience information of doctors (without normal users being able to do this), and at the same time I need to define relationships to do this. I created a model called Doctor and made 'Doctor extends User' and $table = 'users', I defined a few relationships in it, but I don't know what to do about the rest. When I do Doctor::all(), I get no results, how should I proceed? I would be very grateful if you help me.

0 likes
0 replies

Please or to participate in this conversation.