使用未定义的常量 id
Use of undefined constant id
我在尝试查看内容时遇到此错误。
Use of undefined constant id_web - assumed 'id_web' (View: /home/panel/system/app/views/admin/chicawebcam.blade.php)
这是我的代码,型号:
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);
}
});
当 table 上没有内容时,视图加载良好,但是当我添加新内容时,每次加载页面时都会出现此错误。与数据库的连接没有出错。
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 --}}
我在尝试查看内容时遇到此错误。
Use of undefined constant id_web - assumed 'id_web' (View: /home/panel/system/app/views/admin/chicawebcam.blade.php)
这是我的代码,型号:
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);
}
});
当 table 上没有内容时,视图加载良好,但是当我添加新内容时,每次加载页面时都会出现此错误。与数据库的连接没有出错。
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 --}}