dimanche 12 novembre 2017

Authentication and inheritance in Laravel 5.5

I am developing an appointment scheduler in Laravel 5. My system has three major tables: Patients, Doctors, and Appointments.

Appointments can only have one patient and one doctor, but patients and doctors can have many appointments.

I initially approached this by declaring an appointment_id table for both Patient and Doctors, but I realized that I don't know how to authenticate for two separate models so I read about authenticating the User model instead and planned on just extending the User class.

Patients have more details such as health number, while doctors only need a name and a department.

Moreover, patients have sub-roles, and doctors have subroles too (as to what their specialization will be)

I have read about polymorphism, defining roles for the User model for authentication, and multi-auth, and I am quite confused as to how to approach this. If anyone could point me in the right direction to get started, that would be awesome. I have defined seeders and factories for my initial Patient and Doctor tables, but I don't know how to implement it with Laravel only authenticating the User model.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2zDAiuv
via IFTTT

Aucun commentaire:

Enregistrer un commentaire