我有一个无法更改的数据库。当表之一没有主键时。这是表格的模块:
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
//////////////////////////////////////////////
class t_hendtl extends Model
{
//
//protected $primaryKey = 'hen_num';
protected $table = 't_hendtl';
public $timestamps = false;
public $incrementing = false;
protected $primaryKey = null;
}
在新星方面,我只是不使用ID字段。看起来像这样:
public function fields(Request $request)
{
return [
//ID::make()->sortable(),
Text::make('Inv number', 'hen_num'),
Text::make('Inv type', 'hen_type'),
];
}
但是我收到此错误:
SQLSTATE[42000]:[Microsoft][ODBC Driver 13 for SQL Server][SQL Server] An object or column name is missing or empty. For SELECT INTO statements, verify each column has a name. For other statements, look for empty alias names. Aliases defined as "" or [] are not alowed. Chane the alias to a valid name. (SQL:select top 26*from[t_hendtl]order by [t_hendtl].[] desc).
您建议做什么?
答案 0 :(得分:0)
我终于在该表中添加了一个列,尽管该表是其他软件正在使用的表。否则它将无法正常工作