LaravelInstaller icon indicating copy to clipboard operation
LaravelInstaller copied to clipboard

compact(): Undefined variable: envConfig

Open AMAFsoft opened this issue 4 years ago • 5 comments

after installation wizard finished .

i got this error : compact(): Undefined variable: envConfig file : \vendor\rachidlaasri\laravel-installer\src\Controllers\EnvironmentController.php Line : 97 Url : http://127.0.0.1:8000/install/environment/saveWizard

i'm using laravel 5.8 Screenshot of Whoops! There was an error

AMAFsoft avatar Aug 22 '19 22:08 AMAFsoft

i've tried to add the variable to the controller like this

$envConfig = $this->EnvironmentManager->getEnvContent();

and it works of course.

As you can see the saveWizard method throw this error when the validation failed. And this is the problem here! I'm working locally and using default localhost phpmyadmin with no password

and the validation failed because the database password field is empty Screenshot of Step 3 _ Environment Settings _ Guided Wizard _ Laravel Installer

I think the password field should be nullable

AMAFsoft avatar Aug 22 '19 22:08 AMAFsoft

@AMAFsoft I don't like to modify vendor files. Do you have any advise to workaround this issue without modifying those files?

kloentje2 avatar Jan 07 '20 21:01 kloentje2

@kloentje2 as you can see no one answered !! Anyway ,if you want to fix this issue just create EnvironmentController.php in your App\Contollers extended from \vendor\rachidlaasri\laravel-installer\src\Controllers\EnvironmentController.php not from the default controller and start override it methods . ex :

<?php
namespace App\Http\Controllers;
use rachidlaasri\laravel-installer\src\Controllers\EnvironmentController as EnvironmentPackage; //you can put any name

class EnvironmentController extends EnvironmentPackage
{
    // Override methods here
}

This way you can edit package files without touching vendor.

Note : this solution didn't tested yet I hope this works for you!

AMAFsoft avatar Jan 09 '20 10:01 AMAFsoft

For the second error message : database password field is required. Please refer to this pull request f693fba

AMAFsoft avatar Jan 09 '20 10:01 AMAFsoft

@kloentje2 as you can see no one answered !! Anyway ,if you want to fix this issue just create EnvironmentController.php in your App\Contollers extended from \vendor\rachidlaasri\laravel-installer\src\Controllers\EnvironmentController.php not from the default controller and start override it methods . ex :

<?php
namespace App\Http\Controllers;
use rachidlaasri\laravel-installer\src\Controllers\EnvironmentController as EnvironmentPackage; //you can put any name

class EnvironmentController extends EnvironmentPackage
{
    // Override methods here
}

This way you can edit package files without touching vendor.

Note : this solution didn't tested yet I hope this works for you!

For the second error message : database password field is required. Please refer to this pull request f693fba

An easy way I sort this issue out was editting the installer.php in the app\config.php. Publishing installer.php with php artisan vendor:publish --tag=laravelinstaller you will have access to edit installer requirement.

sirdoro1 avatar Feb 26 '20 11:02 sirdoro1