Laravel-阶级';设置';找不到


Laravel - Class 'Setting' not found

我正在使用Laravel 4.2&在我的生产服务器上获得Class 'Setting' not found错误,而它在我的本地主机上运行良好。这是我的控制器代码(部分)

这是我的控制器代码:

<?php 
// app/controllers/ClaimController.php
class ClaimController extends 'BaseController {
  public function create()
  {
    $insurers       = Insurer::lists('insurers_name', 'id');
    $office         = Office::lists('office_name', 'id');
    $workshops      = Workshop::lists('workshop_name', 'id');
    $type_of_report = Setting::where('grp','=','type_of_report')->lists('name','id');
    $vehicle_type   = Setting::where('grp','=','vehicle_type')->lists('name','id');
    return View::make('claim.create')->with('insurers',$insurers)->with('office',$office)->with('workshops',$workshops)->with('type_of_report', $type_of_report)->with('vehicle_type', $vehicle_type);
  }
}

型号代码:

<?php
// app/models/setting.php
    class Setting extends Eloquent {
    }
?>

获取此错误

Symfony ' Component ' Debug ' Exception ' FatalErrorException (E_ERROR) 
Class 'Setting' not found

当我将create()函数中的上述两行更改为时

$type_of_report = DB::table('settings')->where('grp','type_of_report')->lists('name','id');
$vehicle_type   = DB::table('settings')->where('grp','vehicle_type')->lists('name','id');

在生产服务器上运行良好&在我的本地主机上。

问题可能是您的模型文件名为setting.php,并且应该是带大写字母的Setting.php。在localhost(可能是Windows)上,它可以正常工作,因为在Windows文件aaaAAA是相同的,但在Linux中则不同。