I believe the issue here if I have to blindly guess is that you use the same URL for different CRUD. Or you have tried the same one for index and then changed the table name. Just to make sure you can use the setUniqueId to make sure that your table is corresponding correctly.
The reason that this is happening is that Grocery CRUD stores the column data into the local storage of the browser. And the only way to understand that this is the unique CRUD is by getting this uniqueId. If the unique id is not set then it is trying to have a uniqueID from the URL (which usually it is unique since we have one URL for each table)
setUniqueId is the best way actually. The less Grocery CRUD is trying to auto-guess, the better
On the other hand, I have like 4 reports this month that this is happening so it is kind of annoying facing that to be honest as a developer
In the future I want also to introduce the 'environment' = >'debug' configuration so you can have some helpful tools in case you would like to debug an issue that you have in development.
Well, i you add setUniqueId here >> Install Grocery CRUD Enterprise in Laravel 10 | Grocery CRUD v3 i think it will be enough. setUniqueId should’ve been used from the start, just like $crud->setCsrfTokenName('_token') and $crud->setCsrfTokenValue(csrf_token())
Fair point @heruprambadi but I am trying to minimise the extra line if possible. I think in a future version it will have the url and the table name combined so this issue will go away even without the setUniqueId
I will keep you updated for this. For now you can do something like this:
/**
* Get everything we need in order to load Grocery CRUD
*
* @return GroceryCrud
* @throws \GroceryCrud\Core\Exceptions\Exception
*/
private function _getGroceryCrudEnterprise($tableName) {
$database = $this->_getDatabaseConnection();
$config = config('grocerycrud');
$crud = new GroceryCrud($config, $database);
// Don't forget those two below lines if you are
// using CSRF protection (enabled by default on Laravel 10)
$crud->setCsrfTokenName('_token');
$crud->setCsrfTokenValue(csrf_token());
$crud->setTable($tableName);
$crud->setUniqueId($tableName);
return $crud;
}
So you can always set the table and the uniqueId at the same time