you will need to read the file, json decode it to a php object set the required value, then write it again back json decoded.
File::put('path', json_encode($object));
You can also see this example: https://hdtuto.com/article/how-to-read-and-write-json-file-in-php-laravel
I hope it can help you
Use like ,
$data = json_decode($your_file_content,true),
then modify $data as normal php array, and before save use json_encode($data) and save data.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community