Laravel - get last row using whereHas

前端 未结 3 948
故里飘歌
故里飘歌 2020-12-18 14:51

I am trying to get the time \"created_at\" for the last user activity, I have the model User, and UserActivity.
I want to get the last user act

3条回答
  •  抹茶落季
    2020-12-18 15:19

    main structure: model::latest()->get()

      $latest_activites = User::with('activites')
                        ->where("activites",function($query){
                         .
                         .
                         .
                         .
                })->latest()->get();
    

提交回复
热议问题