post by gelinger on Jul 18, 2023

A latest enterprise version with laravel 10 is not working with me.

Trying to access array offset on value of type bool

public function admin_geo_parts()

{

    $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('parts');
$crud->setSubject('Customer', 'Customers');

$output = $crud->render();

return $this->_showOutput($output);


         }

post by johnny on Jul 18, 2023

Hello @gelinger ,

That’s really weird! Can you var_dump the $output to see that we are getting the expected results?

For example:

var_dump($output);
die;

Also maybe to have the function inside a try catch? Maybe something like this?

try {
  $database = $this->_getDatabaseConnection();
    $config = config('grocerycrud');

    $crud = new GroceryCrud($config, $database);
...
$output = $crud->render();

} catch (Exception $e) {
    echo 'Caught exception: ',  $e->getMessage(), "\n";
}

will give a better error message?

The error is very misleading to be honest. Are you using any third-party library? Also what version of Grocery CRUD Enterprise are you using?

Regards
Johnny

post by gelinger on Jul 18, 2023

5 months later

post by NOLO on Dec 28, 2023

In some cases I use views (my database is postgres) and set the property $crud->setPrimaryKey, only in one case it did not work for me.
so check the model and add these lines for testing:
if (!$primaryKeyData){
$primaryKeyData = array(‘attname’ => ‘id’);
}

I make sure that the “primary key” of the views is the id field

post by johnny on Dec 28, 2023

post by NOLO on Dec 29, 2023

post by johnny on Dec 29, 2023

Hello @NOLO ,

I am confused. I thought that you were using the latest version 3.0.19 no? Any reason that you are not using the latest version?

Regards
Johnny

post by NOLO on Dec 29, 2023

Sorry Johnny, it was my fault, I just wanted to help someone else with another error that I didn’t report.

post by johnny on Dec 30, 2023

1 / 9
Jul 2023