(1/1) FatalErrorException App\CuentasBancarias::$incrementing 的访问级别必须是公开的(如类 Illuminate\Database\Eloquent\Model)

Gin*_*cho 1 model laravel eloquent

我有这个模型连接到 SQLSERVER 数据库,使用一个插件,允许我从数据库生成我的模型。但是在尝试访问视图时出现此错误。

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;


class CuentasBancarias extends Model
{

protected $table = 'CUENTASBANCARIAS_GRUPO7F';


protected $primaryKey = 'idcuentasbancarias';


protected $incrementing = false;

protected $fillable = ['idcuentasporcobrar', 'idcuentaporpagar', 'nombre_banco', 'nro_cuenta', 'titular_cuenta', 'fecha', 'total_deposito', 'total_retiro', 'Id_CLIENTES', 'Id_COMPRAS', 'Id_PROVEEDORES', 'id_VENTAS', 'Estado'];

/**
 * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
 */
public function cuentasporcobrarGRUPO7F()
{
    return $this->belongsTo('App\CuentasporcobrarGRUPO7F', 'idcuentasporcobrar', 'idcuentasporcobrar');
}

public function cuentasporpagarGRUPO7F()
{
    return $this->belongsTo('App\CuentasporpagarGRUPO7F', 'idcuentaporpagar', 'idcuentaporpagar');
}


public function sUBCUENTASGRUPO9s()
{
    return $this->hasMany('App\SUBCUENTASGRUPO9', 'idcuentasbancarias', 'idcuentasbancarias');
}
Run Code Online (Sandbox Code Playgroud)

}

Jac*_*cob 7

仔细阅读那里的错误消息。

(1/1) FatalErrorException App\CuentasBancarias::$incrementing 的访问级别必须是公开的(如类 Illuminate\Database\Eloquent\Model)

如果我们分解它,你的问题是这样的

App\CuentasBancarias::$incrementing 的访问级别必须是公开的

所以protected $incrementing = false;改为public $incrementing = false;

您阅读错误消息的能力越好,您就越能更好地解决此类问题。