Php 编写器更新模型方法调用未定义后的Laravel

Php 编写器更新模型方法调用未定义后的Laravel,php,laravel-4,Php,Laravel 4,我正在使用Laravel 4.2进行一个项目,我创建了一些模型和控制器,并从控制器调用了模型函数,问题是在composer update命令之后,它显示了以下错误:调用未定义的方法Department::getAllParent()但在composer update之前,它工作正常。你认为这个问题有什么问题?提前谢谢 型号代码: class Department extends Eloquent{ /** * The database table used by the mo

我正在使用Laravel 4.2进行一个项目,我创建了一些模型和控制器,并从控制器调用了模型函数,问题是在
composer update
命令之后,它显示了以下错误:
调用未定义的方法Department::getAllParent()
但在
composer update
之前,它工作正常。你认为这个问题有什么问题?提前谢谢

型号代码:

class Department extends Eloquent{

    /**
     * The database table used by the model.
     *
     * @var string
     */
    protected $table = 'department';

    public static function getAll()
    {

        $table = DB::table('department');
        $object = $table->get();

        return $object;
    }
    public static function getAllParent()
    {

        $table = DB::table('department');
        $table->where('parent',0);
        $object = $table->get();

        return $object;
    }
}
和控制器代码:

class DepartmentController extends BaseController
{

    /*
    Getting all records from department
    @param: none
    @Accessiblity: public
    @return: Object
    */
    public function getAllDepartment()
    {
        //get data from model
        $deps = Department::getAllParent();
        $depAll = Department::getAll();

        //load view for users list
        return View::make("department.dep_list")->with('deps',$deps)->with('all',$depAll);
    }
}

不要认为这与您的问题有关,但这可能是处理这些查询的更好方法。您正在使用Elount并设置table参数。为什么不使用雄辩的内在力量

class Department extends Eloquent{

    /**
     * The database table used by the model.
     *
     * @var string
     */
    protected $table = 'department';

    public static function getAll()
    {
        return Department::get();
    }
    public static function getAllParent()
    {
        return Department::where('parent', 0)->get();
    }
}

我想你也可以使用
$this->get()但我现在无法测试

请尝试compoer转储自动加载。希望它能起作用。我这样做了,但没有起作用。请给我们看看你的型号代码