我正在使用Laravel 4.2 &在我的生產服務器上出現Class 'Setting' not found
錯誤,而它在我的本地主機上運行正常。這裏是我的控制器代碼(部分)Laravel - 'Setting'找不到
這裏是我的控制器代碼:
<?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
當我改變 上面兩行創建()函數來
$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');
在我的本地工作的生產服務器上&罰款。
您確定這不是設置的拼寫錯誤嗎? – Prasanth 2014-11-02 06:16:42
是的,我重新檢查過,這不是一種類型。 – Aman 2014-11-02 06:23:40
你有設置表的相應模型文件嗎? – Prasanth 2014-11-02 06:28:54