Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/233.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 未定义常量id的使用_Php_Laravel 5_Undefined - Fatal编程技术网

Php 未定义常量id的使用

Php 未定义常量id的使用,php,laravel-5,undefined,Php,Laravel 5,Undefined,当我试图查看内容时出现此错误 使用未定义的常量id_web-假定为“id_web”(视图:/home/panel/system/app/views/admin/chicawebcam.blade.php) 这是我的代码,型号: class Web extends Eloquent { protected $connection = 'casting'; protected $table = 'ch_web'; protected $primaryKey = 'id_web

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

使用未定义的常量id_web-假定为“id_web”(视图:/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);
    }
});
当表上没有内容时,视图加载良好,但当我添加新内容时,每次加载页面时都会出现此错误。与数据库的连接没有给出错误

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
@extends('layouts.admin'))
@节(“内容”)
@foreach($blogs作为$blog)
{{$blog->nombre}
@endforeach
$(文档).ready(函数(){
//Multiselect-Select2插件
$(“#多”)。选择2();
$(“#源”)。选择2();
});
@停止

问题很简单,我不知道这就是问题所在(我以前没有遇到过)。我将所有评论更改为:

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

问题很简单,我不知道这就是问题所在(我以前没有遇到过)。我将所有评论更改为:

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

在你的代码中的某个地方(不是你发布的代码),你正在使用没有任何引号的id_web。我没有任何没有引号的东西检查此文件:chicawebcam.blade.phpI已经检查过了,我找不到任何你需要再次检查的东西。如果代码无法运行,则会出现问题。在代码的某个地方(不是您发布的代码),您正在使用id_web,没有任何引号。我没有任何不带引号的内容检查此文件:chicawebcam.blade.phpI已经检查过了,我找不到任何需要再次检查的内容。如果代码无法运行,则会出现问题。