laravel-livewire-tables icon indicating copy to clipboard operation
laravel-livewire-tables copied to clipboard

Don't works if model primaryKey is not `id`

Open PrestaSafe opened this issue 4 years ago • 1 comments

I've a model, Customer

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Customer extends Model
{
    protected $table = 'customer';
    protected $primaryKey = 'id_customer';
}

and i've this error: Capture d’écran 2020-09-01 à 19 52 15 If i change to key (in the database) to id it's working !

I'm issing something ?

Thanks

PrestaSafe avatar Sep 01 '20 17:09 PrestaSafe

@PrestaSafe You can easy fix this by adding public $sort_attribute = 'id_customer'; to your table component.

bobkosse avatar Apr 16 '21 13:04 bobkosse