I can't turn off debug bar in Laravel on production

It is not a matter of debugbar, it is general problem with .env. You can change your APP_NAME to see that it is not changing anything.

To apply your new config changes including .env changes you need to run artisan command in your project folder:

php artisan config:cache

did u try changing it in the .env file.

look for the value APP_DEBUG in the .env file and set it false.

Out of the box, .env has it set to true.


Solution for 5.5 and above

Install the package with:

composer require barryvdh/laravel-debugbar:dev-master

Because of the package auto-discovery feature, you don't need to add package's service provider to the providers list in config/app.php and Debugbar will only be loaded in the development environment.

Solution for 5.4 and below

Put this code to the AppServiceProvider@register:

if ($this->app->isLocal()) {
    $this->app->register('Barryvdh\Debugbar\ServiceProvider');
}

Don't forget to remove Laravel Debugbar line from config/app.php providers section.

After doing this, Laravel Debugbar will only be loaded in a local environment.