Can't show data

Hello @johnny , i have question. I can show data with GCE, but some table can’t show the data.

This is my MySql :

CREATE TABLE `ppob_product` (
  `id` int NOT NULL,
  `product_name` varchar(22) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `ppob_product` (`id`, `product_name`) VALUES
(1, 'aa'),
(2, 'ss');

ALTER TABLE `ppob_product`

and this is my code :

public function index()
         $crud = $this->_getGroceryCrudEnterprise();
         //$crud->where(['per_info_personal.id_payroll >= ?' => 0]);
         $crud->setSubject('Produk', 'Daftar Produk');
         $output = $crud->render();
         return $this->_showOutput($output);

the data not showing :

can you help me @johnny ?

i found the problem. Turns out it because my column name is “product_name”. I changed it to “name”, and now it show the data. Why is that?

well, this is weird. I clear cache & cookies and now it works fine.

Ok, i think it’s a bug. It happened again. I have to click “Delete Cache” again, and select all columns.

why do i have to click “delete cache” so often @johnny ?

Hello @heruprambadi ,

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.

See more a the documentation here: setUniqueId | Grocery CRUD v3

For example in your situation you can do this:


So the uniqueId will be your table name.

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)

Let me know if that worked for you.


yes @johnny , your second blind guess is right. I will always use setUniqueId now. Thank’s :beer:

Thank you @heruprambadi for letting me know. I will also have it a look to see if I can fix this issue in Grocery CRUD as well.


Good news @heruprambadi ,

I am also finally able to reproduce the issue that you had so I will try to fix it for the next version.


Thanks @johnny , i solved this problem by using setUniqueId. But if there is any better way, why not :smiley:

setUniqueId is the best way actually. The less Grocery CRUD is trying to auto-guess, the better :slight_smile:

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 :slight_smile:

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.

Thank you for your feedback by the way :slight_smile:

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()) :beer:

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)

        return $crud;

So you can always set the table and the uniqueId at the same time :wink: