I'm trying to be able to write to a json file. I think maybe I missed something because I'm not able to write to the json file and no errors show up.
Here is my code
public function writingToFile($id, $from, $to)
{
mkdir($this->getStoragePath($id, "/file/$to"));
foreach(['name', 'area'] as $file){
copy($this->getStoragePath($id, "/file/$from/$file.json"), $this->getStoragePath($id, "/file/$to/$file.json"));
}
$version_file->area = $to;
$json_file = file_get_contents($this->getStoragePath($id, '/file/$to/area.json'));
$version_file = json_decode($json_file);
file_put_contents($this->getStoragePath($id, "/file/$to/area.json"), json_encode($version_file, JSON_PRETTY_PRINT));
}