Viewed   484 times

I added this variable to .env file

STRIPE_SECRET=a12345

I would like to dump the variable using routes/web.php

<?php
dd(env('STRIPE_SECRET'));

But it looks like it always returns null.

Update : Updated .env file. I only removed DB_PASSWORD.

APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:08txDXXatyYsP5WQ4ECz35Q7OyBEe8Vgb/zK5fZsHik=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://localhost
APP_LOCALE=tr
APP_LC_ALL=tr_TR.utf8

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=gunluk
DB_USERNAME=root
DB_PASSWORD=

BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=03ac580c85842d
MAIL_PASSWORD=1d6d902d296942
MAIL_ENCRYPTION=null

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=

STRIPE=a123
STRIPE_SECRET=a12345

 Answers

1

The main reason upon your issue is that you are caching your configuration. When running php artisan config:cache you're storing your configuration in your cache, and the next time Laravel will boot up it won't read the .env file because it detects that the configuration has been stored in the cache. Environment file should be used only to setup configuration files and then to access the value you're looking for you should use ONLY the config method.

Let's assume that you have the file config/stripe.php that consists of this content:

<?php

return [
    'secret' => env('STRIPE_SECRET', '')
];

Once you run php artisan config:cache access this value using ONLY the syntax config('stripe.secret') through your application code. Every time you update your config files and your .env you need to run php artisan config:cache again.

Friday, December 23, 2022
 
1

$model->update() updates and saves the model. Therefore, $model->isDirty() equals false as the model has not been changed since the last executed query (which queries the database to save the model).

Try updating the model like this:

$partner = Partner::find($id);

foreach ($partnerData as $column => $value) {
    if ($column === 'id') continue;

    $partner->$column = $value;
}

if ($partner->isDirty()) {
    // should be dirty now
}

$partner->save(); // $partner will be not-dirty from here
Wednesday, August 3, 2022
1

Recommended approach if you put here only methods (not classes):

  1. Create file anywhere you want
  2. In composer.json make sure you add this file to files key inside autoload like this:

    "autoload": {
        // here other autoload things
    
        "files": ["app/Helpers/AnythingHelper.php"]
    },
    
  3. Run composerdump-autoload`

For classes obviously you should use standard PSR-4 autoloading

Sunday, October 23, 2022
 
dvir
 
2

The "illuminate/html" component is no more supported by Laravel and is not compatible with the 5.2 version.

You can replace it with laravelcollective/html

You have to:

  • remove the reference of "illuminate/html": "^5.0@dev", from composer.json

  • add "laravelcollective/html": "5.1.*" (or the version you want)

  • run composer update to update the dependecies (this will remove your "illuminate/html" component and install the "laravelcollective/html" component

Now you have to replace your HTML service provider with:

 'providers' => [
    CollectiveHtmlHtmlServiceProvider::class,
  ],

and the facades:

  'aliases' => [
      'Form' => CollectiveHtmlFormFacade::class,
      'Html' => CollectiveHtmlHtmlFacade::class,
  ],
Wednesday, December 21, 2022
 
showdev
 
1

Your request looks fine, it should work. Did you set up services.wsdl with your EWS server address? (see http://ewswrapper.lafiel.net/basic-info/working-with-ewswrapper/ for some more info)

Try looking at the actual call before it is send and the response before it is interpreted. To do so in NTMLSoapClinet.php print $request at the top of __doRequest() function and end script execution (ie. die()) and then try printing $response befor it is returned in __doRequest() function and end script execution. This should give you some more insight on what's going on.

Friday, December 9, 2022
Only authorized users can answer the search term. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :