Search
 
SCRIPT & CODE EXAMPLE
 

PHP

update laravel .env variables dynamically

   /**
     * Update Laravel Env file Key's Value
     * @param string $key
     * @param string $value
     */
    public static function envUpdate($key, $value)
    {
        $path = base_path('.env');

        if (file_exists($path)) {

            file_put_contents($path, str_replace(
                $key . '=' . env($key), $key . '=' . $value, file_get_contents($path)
            ));
        }
    }
Comment

PREVIOUS NEXT
Code Example
Php :: in laravel date duration validation rule 
Php :: laravel eloquent without relation 
Php :: IlluminateContractsContainerBindingResolutionException target calss does not exist 
Php :: how to store an image in laravel directly from url 
Php :: get deleted value laravel 
Php :: php do not refresh page after submit post 
Php :: unique array 
Php :: générer des nombres aléatoires décimaux en php 
Php :: mysqli fetch row assoc 
Php :: title tag wordpress 
Php :: laravel grouping where 
Php :: php time to date 
Php :: php has constant 
Php :: php value to javascript variable laravel blade 
Php :: date format in wordpress post 
Php :: Filtering Eloquent collection data with filter 
Php :: uppercase php 
Php :: unique check with multiple columns laravel validation 
Php :: wp plugins action link 
Php :: drupal 8 get enabled languages 
Php :: a facade root has not been set laravel 7 
Php :: laravel create new file if not exists 
Php :: doctrine query builder order by multiple 
Php :: format a number with leading zeros in php 
Php :: eloquent where parentheses 
Php :: get specific columns using with() function in laravel eloquent 
Php :: replace key in php 
Php :: laravel migration delete column 
Php :: json encode decode 
Php :: Catches the last error php 
ADD CONTENT
Topic
Content
Source link
Name
3+4 =