I am updating values of files under the lang folder. All files has an array and I want to update that array's value from user.
For example,
en/messages.php
files has array like
<?php
return [
'hello' => 'hi'
];
Now I am sending these pairs to users. A user can able to change the only value of that label.
What I have done is
public function update(Request $request, $lang, $file)
{
$r = $request->input('lang');
Storage::put('lang/' . $lang . '/' . $file.'.php', $r);
return redirect()->back();
}
But I am getting only values of that array. I want the output in a file like:
Desired Output:
<?php
return [
'hello' => 'helo'
];