F
Filament7mo ago
arif

Displaying data without an ID or primary key

I want to display data from a table, but if I use Filemant, how can I do it? I don't have an ID column or a primary key column. However, I have an NIK column which has a string data type. If I create the model like this, then the data displayed by the table shows all the NIK values initially as strings, but they change to the number 0 if I make NIK the primary key.
No description
No description
No description
2 Replies
Kaesa Lyrih
Kaesa Lyrih7mo ago
Try add:
// ...
protected $primaryKey = 'NIK';
public $incrementing = false;
protected $keyType = 'string';
// ...
// ...
protected $primaryKey = 'NIK';
public $incrementing = false;
protected $keyType = 'string';
// ...
arif
arifOP7mo ago
Thank you! @Kaesa Lyrih But why when I try with a different table (though the contents are the same), it doesn't work? There's an error message like this.
No description
Want results from more Discord servers?
Add your server