Due to a Model Name change, my class Student
doesn't works properly now. With a database called assos
:
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` text COLLATE utf8mb4_unicode_ci NOT NULL,
`student_id` text COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
linked with a model Asso
,
The query App\Asso::first()->belongsTo(Student::class)
returns null
When the query App\Asso::first()->belongsTo('App\Student','student_id')
returns the associated student.
I don't understand why belongsTo(Student::class)
doesn't work properly. Can you help me to figure it out?
Thanks a lot
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2l0yz7T
via IFTTT
Aucun commentaire:
Enregistrer un commentaire