2017-07-23 1 views
0

Ich habe zwei Tabelle mit den folgenden FeldernDer Versuch, die Beziehung mit Laravel eloquent zu bekommen, aber bekommen null

adviser_group 
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, 
`user_id` INT(10) UNSIGNED NOT NULL, 
`organization_id` INT(10) UNSIGNED NOT NULL, 

organizations 
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, 
`name` VARCHAR(191) NOT NULL COLLATE 'utf8mb4_unicode_ci', 
`status` TINYINT(4) NOT NULL DEFAULT '0', 

adviser_group hat 1 Reihe, hat Organisation viele Reihe

Mit Laravel uloquent ich versuche, dazu

$organization = OrganizationAdviserGroup::with('organization') 
    ->where('user_id', '=', Auth::user()->id) 
    ->get(); 

Aber was ich bekommen, ist die organization = null

Mache ich es falsch?

Antwort

0

wenn Sie Laravel verwenden nur an diesen Dokumenten aussehen, dann ist es wirklich einfach und leicht Eloquent Relationships

zu verstehen
Verwandte Themen