没有主键的Laravel NOVA会出错

问题描述 投票:1回答:1

我有一个我无法改变的数据库。当其中一个表没有主键时。这是表格的模块:

<?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).

你有什么建议的?

laravel laravel-nova
1个回答
0
投票

我最后在表中添加了一个列,尽管它是一个其他软件正在使用的表。否则它不会工作

© www.soinside.com 2019 - 2024. All rights reserved.