public function __get($name)
{
if ($name == 'pk') {
// Retrieve the primary key from the columns
// Get the related columns
$columns = $this->tabularColumns()->getResults();
foreach ($columns as $column) {
if ($column->is_pk) {
return $column->index;
}
}
return -1;
}
return parent::__get($name);
}