首先,抱歉我的英语不好。我有专栏:
$table->json('images')->nullable();
Run Code Online (Sandbox Code Playgroud)
表称为相册。在图像中,我想存储一个包含图像名称的数组,但如何每次都添加到该 json 中?我现在的代码:
$album = Album::where('hash', $request->album_hash)->firstOrFail();
$album->update([
'images' => $request->image->name <= tried to do something.. My uploader everytime calls this function, so I need to get current IMAGES column value, and add new. Like ['first image name', 'second image name'], after update this must be ['first image name', 'second image name', 'third image name'] not just ['third image name']
]);
$album->save();
Run Code Online (Sandbox Code Playgroud)
我需要像 Laravel 增量函数一样,但它只适用于 int 看起来像。我怎样才能做到这一点?提前致谢!