Open Ticlext-Altihaf opened 1 month ago
public static function setAppName(string $appName) { // hacking env $envFile = app()->environmentFilePath(); $str = file_get_contents($envFile); // sanitizing, only allow alphanumeric, underscore, and space $appName = preg_replace("/[^a-zA-Z0-9_ ]+/", "", $appName); // warp in double quote $appName = '"' . $appName . '"'; $str = preg_replace("/APP_NAME=(.*)/", "APP_NAME=$appName", $str); //hopium file_put_contents($envFile, $str); }
mount
setAppName
Reference: https://github.com/natindonesia/learning-diary-web/blob/master/app/Filament/Admin/Pages/AppSettings.php