Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如何在 DB 查询构造器的 chunkMap 方法里使用翻译文件,来翻译数组? #355

Open
andyzu opened this issue Feb 3, 2023 · 1 comment

Comments

@andyzu
Copy link

andyzu commented Feb 3, 2023

以下内容是我的翻译文件 message.php 文件
image

下面是我的 controller :
image
下面是我通过 SQL 查询出来的接口 json 数据:
image
想把红框部分的内容,翻译成 "skis": "[\"单板\", \"双板\"]",

查看了文档也没思考出这种情况下该如何使用,希望能给与指点。

@guanhui07
Copy link
Contributor

没用过这个方法,我一般类似laravel 那么获取

->where('test',11)->where('age','>',1)->get()->map(function($item){
      // do sth if you want 
     $data=[];
     $data['test1'] = changeYouWant($item->skins);
     return $data;
})

laravel collection 很香

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants