我想使用Model :: with(relationships)方式来CONCAT多个列名(来自不同的关系)。我们如何做到这一点。
等级
id | name
1 | All
权限
id | level_id | permission_id | name
1 | 1 | 1 | Bob Login
用户
User::with(['level','permission'])
->selectRaw("CONCATE (user.name, ', ', level.name,', ',permission.name) AS uname")
->list('uname','id')->all();
我试过这种方式,但没有工作,我想要输出Bob Login,Admin,All
DB::table('user AS u')
->join('level AS l','u.level_id','=','l.id')
->join('permission AS p','u.permission_id','=','p.id')
->selectRaw("CONCATE (user.name, ', ', level.name,', ',permission.name) AS uname")
->lists('uname','id');
这种方式有效,但我不想要这个
Bitmap[] contentBitmap = new Bitmap[content.size()];
for (int i = 0; i < content.size(); i++) { //content is ArrayList<String>
String bmString = content.get(i);
byte [] encodeByte = Base64.decode(bmString, Base64.DEFAULT); //byte is not null
contentBitmap[i] = BitmapFactory.decodeByteArray(encodeByte, 0, encodeByte.length); //here I get null
}
adapter = new ViewPagerAdapter(this, contentBitmap);