내가 그것을 가지고있다. 나는에 아래 라인을 추가 할 때 지금
Connections.php
public function owners()
{
return $this->belongsTo('App\Owners', 'owner_id');
}
Owners.php
public function connections()
{
return $this->hasMany('App\Connections');
}
public function rooms()
{
return $this->belongsTo('App\Rooms', 'room_id');
}
Rooms.php
public function owners()
{
return $this->hasMany('App\Owners');
}
과 : 나는 앱에서 다음과 같은 관계를 넣어했다 내 ConnectionsController.php
$connections = Connections::with('owners')->paginate(5);
내 index.blade 작성에 참조 할 수 있습니다 : 소란에 대한
@foreach($connections as $element)
{{ $element->owners->rooms->room_number }}
@endforeach
@AlexeyMezenin 죄송합니다.
정확하게 무엇을 가지고 있습니까? (ID는 무엇입니까?) 정확히 무엇을 얻고 싶습니까? –
나는 그 (것)들 사이 관계에 상기 테이블이있다. 따라서 연결 테이블은 소유자 테이블에 대한 액세스 권한을 가지며 소유자 테이블은 회의실 테이블에 대한 액세스 권한을 갖습니다. 하지만 지금은 room_number를 연결 테이블에 넣고 싶습니다. 예 : connections-> owners-> rooms-> room_number (하지만이 방법으로는 작동하지 않는다는 것을 알고 있습니다.) – Patryk