欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

Eloquent 联合查询的主对象

$user_activitys = Activity::join('users','users.id','=','activity_log.user_id')
    ->select('activity_log.id as id','activity_log.operated_created_at as operated_created_at','activity_log.created_at as created_at')
    ->where('activity_log.is_finance','=',1)->orderby('activity_log.id','desc')->paginate(20);
$user_activitys[0]的主对象是 Activity 实例的对象


$user_activitys = User::join('users','users.id','=','activity_log.user_id')
->select('activity_log.id as id','activity_log.operated_created_at as operated_created_at','activity_log.created_at as created_at')  ->where('activity_log.is_finance','=',1)->orderby('activity_log.id','desc')->paginate(20);

$user_activitys[0]的主对象是 ​User 实例的对象
普通分类: