i"m using laravel+Nova, connecting to existing database of an existing software. The primary key is not the deault "ID" so at the "model" i changed it to like that:
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class products extends Model
{
//
protected $table = 't_items';
protected $primaryKey = 'item_num';
public $timestamps = false;
}
============================================================= When changing and updating the satabase (With nova) there is no error. However when using save (for new or existing row) there is an error:
SQLSTATE[42000]:[Microsoft][ODBC Driver 13 forSQL Server][SQL Server] Error converting data type nvarchar to numeric 9SQL select top 1 * drom [t_items][item_num] = null
"item_num" is defined as:
numeric
primary key
Allo nulls = false
Identity = false
Identity seed = 0
Identity increment = 0
Length = 9
Numeric precision = 10
Numeric scale = 0
What should i add. i think laravel soed not defining the ID when saving and the server needs it