我正在关注代码:
$gallery->photos->first()
此返回:
{"id":3,"gallery_id":1,"filename":"IMG_3700.png","filesize":4229181,"delete":0,"created_at":"2020-03-28T09:56:31.000000Z","updated_at":"2020-03-28T09:56:31.000000Z"}
我需要访问文件名。我尝试了一些操作,但没有一个起作用:
$gallery->photos->first('filename')
$gallery->photos->first()->get('filename')
$gallery->photos->first()['filename']
$gallery->photos->first()->filename
我如何访问返回的文件名?
谢谢
确保您没有从控制器返回json对象。