-2
내 데이터베이스에 두 개의 테이블이 있습니다.게시물을 작성한 모든 사용자의 목록을 얻는 방법
Users
id,name
Posts
id,user_id,name
// user_id is the id who has created the post.
How do i get list of all users that have created the posts.
Relation in users table is like this.
=> user HasMany posts.
The relation in Post Class
=> post belongsTo users.
What i have tried so far
$uses = User::with('posts')->get();
This returns list of all users,that has not even created the post
이 문제에 대해 새로운 관계를 업데이트해야합니까?
왜 투표를 거절 했습니까? 정보가 명확하지 않습니까? 또는 질문은 이해가되지 않습니다. –