求教,Collection的转换如何做?

具体是从这个转换成之后的样子:

Collection {#275 ▼
  #items: array:1 [▼
    0 => Userinfo {#271 ▼
      #table: "userinfos"
      #fillable: array:25 [▶]
      #connection: null
      #primaryKey: "id"
      #perPage: 15
      +incrementing: true
      +timestamps: true
      #attributes: array:33 [▶]
      #original: array:33 [▶]
      #relations: array:1 [▶]
      #hidden: []
      #visible: []
      #appends: []
      #guarded: array:1 [▶]
      #dates: []
      #dateFormat: null
      #casts: []
      #touches: []
      #observables: []
      #with: []
      #morphClass: null
      +exists: true
      +wasRecentlyCreated: false
    }
  ]
}

如何转变为

Userinfo {#268 ▼
  #table: "userinfos"
  #fillable: array:25 [▶]
  #connection: null
  #primaryKey: "id"
  #perPage: 15
  +incrementing: true
  +timestamps: true
  #attributes: array:28 [▶]
  #original: array:28 [▶]
  #relations: []
  #hidden: []
  #visible: []
  #appends: []
  #guarded: array:1 [▶]
  #dates: []
  #dateFormat: null
  #casts: []
  #touches: []
  #observables: []
  #with: []
  #morphClass: null
  +exists: true
  +wasRecentlyCreated: false
}

或者是不是我写得数据库查询有问题?我需要做个两表链接查询

//第二个结果的查询:
$all = Userinfo::find($id);`
//第一个结果的查询
$userinfo = Userinfo::find($id)
->with('user')
->leftjoin('users','users.id','=','userinfos.addman_id')
->where('userinfos.id',$id)
->get();

哦,解决了,只要这样 $collection = $userinfo->first()

woailuosj
修改的评论也不能少于六个字哦!
justtest
修改的评论也不能少于六个字哦!