I'm using Laravel 5 and have multiple models (Patient, Therapist) that extend from User model.
I have some dummy data in the DB (few therapists, few patients).
When I want to retrieve a therapist by id, I try to do so by Therapist::find($id) but get an exception:
'Illuminate\Database\QueryException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 'users_email_unique' (SQL: insert into users
Couple of questions:
1. Why when I use the ::find function, it tries to insert a new user?
2. How can I use the ::find function on objects that extend from User in order to get the attributes that each model has?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire