I'm using laravel spatie in my app. I have a problem.
When an user updates his list of image. Admin must to be approve a list of image which an user just update. If user add image, i just add more. But when an user change an image he had, how to do it? I can't change collection_name because if i change, this image is not appear in user profile. Do you have any ideal for me?
I have an ideal: i add an in custom_properties column with value {'change' => 'false'}
. When user change this image, i will change custom_properties to {'change' => 'true'}
. And when admin approve the change, i must update custom_properties to {'change' => 'false'}
. But i can't access in value of custom_properties column. (As you know, laravel spatie give us an media table , it has a column custom_properties have json data in it). So help me access in to this column and update data in it.
So sorry because my english is not good.
$mediaOld = Media::where(['model_id' => $doctor_id, 'collection_name' => 'doctor_achieved'])->get();
if (isset($mediaOld[$index])) {
$mediaOld[$index]->update(['custom_properties->change' => 'true']);
$mediaOld[$index]->save(); // Its not working
return $mediaOld[$index]->custom_properties;
}