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

这里的技术是共享的

You are here

查询构建器 关系对象模型 eloquent 中 如何使用查询构器

$activitys = Activity::join('users','users.id','=','activity_log.user_id')
    ->select('activity_log.id as id','activity_log.operated_user_id as operated_user_id',
        'activity_log.operated_username as operated_username','activity_log.operated_company as operated_company',
        'activity_log.operated_usertype as operated_usertype','activity_log.operated_role as operated_role',
        'activity_log.operated_created_at as operated_created_at','activity_log.operated_accept_number as operated_accept_number',
        'activity_log.operated_emaining_number as operated_emaining_number','activity_log.operated_end_day as operated_end_day',
        'activity_log.is_finance as is_finance', 'users.name as name','text',
        'activity_log.created_at as created_at','ip_address')
    ->where('activity_log.is_finance','=',1)->orderby('activity_log.id','desc')->paginate(20);

使用 查询构建器 查询构造器 或 eloquent  只有主表中 才可以 得到时间的carbon 比如 Activity 时间字段  类型为 Carbonusers 表的 时间字段字符串string
普通分类: