Laravel 4:无法访问包类中的Auth实例

Laravel 4:无法访问包类中的Auth实例

问题描述:

I have this class in a workbench package:

class SomeClass{

//Constructor
function __construct(){

    $isAuth = Auth::check();   

    }   

But it gives me following error:

Class 'vendor\pachage\Auth' not found 

Is this a namespace issue? I am using the following namespace:

namespace vendor\pachage;

我在工作台包中有这个类: p>

  class  SomeClass {
 
 // Constructor 
function __construct(){
 
 $ isAuth = Auth :: check();  
 
} 
  code>  pre> 
 
 

但是它给了我以下错误: p>

  Class'peller \ pachage \ Auth  'not found 
  code>  pre> 
 
 

这是名称空间问题吗? 我使用以下命名空间: p>

 命名空间vendor \ pachage; 
  code>  pre> 
  div>

You need Fully qualified name, add a backslash:

\Auth::check();

It all described as Namepace resolution.