I create a route
Route::get('/env/{flag}/{value}','GeneralController@envUpdate');
Then, I call it
http://localhost/env/MAIL_REPORT/false
that will trigger this function
public function envUpdate($flag,$value)
{
//dd($flag,$value); đđŒ MAIL_REPORT, false
function setEnv($name, $value)
{
//make sure to run : sudo chmod 777 .env
$path = base_path('.env');
if (file_exists($path)) {
file_put_contents($path, str_replace(
$name . '=' . env($name), $name . '=' . $value, file_get_contents($path)
));
}
}
setEnv($flag,(string)$value);
dd(env((string)$flag));
return env((string)$flag);
}
I kept getting true
because in my .env does not seem to be updated
MAIL_REPORT=true
I suppose to have MAIL_REPORT=false
Note : I already ran : sudo chmod 777 .env
Questions
How would one go about and debug this further ?
I'm open to any suggestions at this moment.
Any hints/suggestions / helps on this be will be much appreciated!
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2HZ4rZo
via IFTTT
Aucun commentaire:
Enregistrer un commentaire