laravel - 没有主键的 Laravel NOVA 会出错
问题描述
我有一个无法更改的数据库。当其中一个表没有主键时。这是表格的模块:
<?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).
你建议做什么?
解决方案
我终于在表格中添加了一列,尽管它是其他软件正在使用的表格。否则它不会工作
推荐阅读
- postgresql - PostgreSQL 如何解释这两个连接语句?
- c# - Android SDK 包列表更新失败
- php - 将硬编码数组合并功能转换为 PHP 中的动态代码
- javascript - 用纯 JavaScript 捕获 SVG onresize()?
- google-chrome - 来自不同 HTTP 流服务器的 HTTPS 站点上的流式广播
- php - Homecontroller在php中不存在错误
- android - 如何将每一个 RecyclerView 数据放到一个文件中
- python - 退出命令停止python文件执行
- angular6 - 如何在特定列的角度材料数据表中进行过滤
- dialogflow-es - 如何处理音频的结束?