使用未定义的常量id



当我尝试查看内容时出现此错误。

使用未定义的常量id_web -假设'id_web'(视图:/home/panel/system/app/views/admin/chicawebcam.blade.php)

这是我的代码,model:

class Web extends Eloquent {
    protected $connection = 'casting';
    protected $table = 'ch_web';
    protected $primaryKey = 'id_web';
}

routes.php

Route::get('/web', function()
{
    $chk = PlController::chkAdmin();
    if($chk == false){
        return Redirect::to('/login');
    }else{
        $blogs = Web::orderBy('name', 'asc')->get();
        return View::make('admin.web')->with('blogs', $blogs);
    }
});

视图加载良好时,没有表上的内容,但当我添加新的东西,我得到了这个错误,每次我加载页面。与数据库的连接没有错误。

blade.php

@extends('layouts.admin')
@section('content')
            <tbody>
                               @foreach($blogs as $blog)
                                            <tr>
                                                <td class="v-align-middle"><span class="muted">{{$blog->nombre}}</span>
                                                </td>
                                                <td class="v-align-middle">
                                                </td>
                                            </tr>
                                            @endforeach
                                        </tbody>
  <!-- END BASIC FORM ELEMENTS--> 
<script>
$(document).ready(function(){
    //Multiselect - Select2 plug-in
    $("#multi").select2();
    $("#source").select2();
});
</script>
@stop

这个问题很简单,我不知道这是问题(它没有发生在我之前)。我将所有注释更改为:

{{-- This comment will not be present in the rendered HTML --}}

最新更新