0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【Lravel】リレーション先のリレーションのデータを紐付けて取得

Posted at

結論

このように書く

    function get_posts(Request $request){
        //リレーション先のaccessesテーブルのtypeで公開ステータス(type=1)に絞り込み
        $posts = Post::>with(['user.profileImage'])->with(['cards'])->get();

        return response()->json( $posts);
    }

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?