protected function getTableProperties($table)
{
$primaryKey = $this->getTablePrimaryKey($table);
$primaryKey = $primaryKey != 'id' ? $primaryKey : null;
$fillable = [];
$guarded = [];
$timestamps = false;
$columns = $this->getTableColumns($table);
foreach ($columns as $column) {
//priotitze guarded properties and move to fillable
if ($this->ruleProcessor->check($this->option('fillable'), $column->name)) {
if (!in_array($column->name, array_merge(['id', 'created_at', 'updated_at', 'deleted_at'], $primaryKey ? [$primaryKey] : []))) {
$fillable[] = $column->name;
}
}
if ($this->ruleProcessor->check($this->option('guarded'), $column->name)) {
$fillable[] = $column->name;
}
//check if this model is timestampable
if ($this->ruleProcessor->check($this->option('timestamps'), $column->name)) {
$timestamps = true;
}
}
return ['primaryKey' => $primaryKey, 'fillable' => $fillable, 'guarded' => $guarded, 'timestamps' => $timestamps];
}