I am trying to detect App environment Laravel 5.3
Inside a controller I am using
if(App::environment('production')) {
......
}
But I am getting this error in laravel.log
local.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException'
with message 'Class 'App\Http\Controllers\App' not found'
in C:\Apache24\htdocs\forum\app\Http\Controllers\PostController.php
Either use a backslash before app
if( \App::environment('production') ) {
................
}
or include Use App;
below your namespace declaration
namespace App\Http\Controllers;
use App;