gareth asked this 1 year ago

'Class 'App\Http\Controllers\App' not found'

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

Julia 1 year ago

Either use a backslash before app

if( \App::environment('production') ) {



or include Use App;

below your namespace declaration

namespace App\Http\Controllers;
use App;