Nean
Nean

Reputation: 85

Laravel 5 error Class 'App' not found in

I am currently learning laravel 5 and wanted to implement the repository concept. as I understand. I should put an ioc.php and the config folder and put my bindings their

Here is my config/ioc.php

<?php 
 App::bind('QuestionRepository', 'IQuestionRepository');
 App::bind('AnswerRepository', 'IAnswerRepository');

I get an error Class 'App' not found in

Upvotes: 0

Views: 12379

Answers (3)

ShivarajRH
ShivarajRH

Reputation: 940

For my case in lumen 5.4, undefined 'App' class issue solved by facade definition:

use Illuminate\Support\Facades\App;

Upvotes: 5

Maarten00
Maarten00

Reputation: 704

In my case, my .env file contained a value with spaces after checking out a new project.

Running php artisan optimize for the first time would throw this error because my Exception handler was trying to use the '\App' global alias for the App facade. Commenting that code showed the real error;

"Dotenv values containing spaces must be surrounded by quotes."

Upvotes: 2

Basit
Basit

Reputation: 971

try prefixing App with \ like \App

Upvotes: 7

Related Questions