Error while loading Laravel Application
Ad
I am new to Laravel framework and after trying to start an application I am receiving this error with this stacktrace:
[2015-12-16 10:29:20] local.ERROR: exception 'ErrorException' with message 'The use statement with non-compound name 'DB' has no effect' in /Users/username/data/product/app/controllers/CampaignsController.php:3
This is how the Controller looks like in the beginning:
<?php
use \DB;
use \Auth;
use \Validator;
use \Event;
........
What am I missing here? Is it because i need to install some plugin for Laravel to work?
Ad
Answer
Ad
You are not located within the namespace, so you can not execute use
statements.
For example, if you're in a controller you might want to add following namespace at the top of the file:
<?php
namespace App\Http\Controllers;
use \DB;
...
Ad
source: stackoverflow.com
Related Questions
Ad
- → "failed to open stream" error when executing "migrate:make"
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS create a multi select Form field
- → October CMS - Conditionally Load a Different Page
- → How to disable assets combining on development in OctoberCMS
- → October CMS - Radio Button Ajax Click Twice in a Row Causes Content to disappear
- → OctoberCms component: How to display all ID(items) instead of sorting only one ID?
- → In OctoberCMS how do you find the hint path?
- → How to register middlewares in OctoberCMS plugin?
Ad