无法在Laravel 5中调用自定义助手阵列

时间:2016-02-29 18:54:13

标签: php laravel

HR_Helper.php

class HR_Helper{
    public static $Grade = array(1,2,3,4);
    public $work_shift = array("Work Shift","Regular Work Hours","Part Time");
    public $Salutation = array('Mr.','Miss','Mrs.','Ms.','Dr.'); 
    public $leave_types = array('Sick Leave','Maternity Leaves','Casual Leaves','Annual Leaves');    
    public $leave_status = array(0,1,2);        
}

现在我在控制器中调用这些辅助数组......

hrController.php

HR_Helper::Grade;

但它会抛出以下错误

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

我还在控制器中添加了这些Helper ..(use HR_R;

HR_R帮助器也添加在app.php - >中。 aliases喜欢 'HR_H' => App\Helpers\HR_Helper::class

但它仍无效......

0 个答案:

没有答案