vendredi 19 octobre 2018

Why values from .env file are empty?

I opened my old application

# php artisan --version
Laravel Framework 5.5.18

and testing it on my local laptop and on remote server(ubuntu 18 in both cases ) I suddenly found that some variables from .env file, like :

UPLOADS_CMSITEM_IMAGES_URL = 'uploads/cms_items/'
UPLOADS_CMSITEM_IMAGES_DIR = 'uploads/cms_items/'

UPLOADS_CATEGORY_IMAGES_URL = 'uploads/categories/'
UPLOADS_CATEGORY_IMAGES_DIR = 'uploads/categories/'

and calling it in my model I have empty value

public static function getCategoryUrl(int $category_id, string $img, bool $check_existing= false) : string
{
    if ( empty($img) ) return '';
    $base_url= with(new Settings)->getBaseUrl();
    $UPLOADS_CATEGORY_IMAGES_URL= env('UPLOADS_CATEGORY_IMAGES_URL');

and my path is invalid...

I run

php artisan config:cache

several times, but UPLOADS_CATEGORY_IMAGES_URL returns empty value...

How it can be and how to fix it ?

Thanks!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire