Can I setup CRUD Controller in the way to show fields depending on model is editing?
Example: I have model with fields: id
, type
, field1
, field2
.
For models with type=type1
I want to show only field1
:
$this->crud->addFields([
['name' => 'field1', 'label' => 'field1 label']
]);
for models with type=type2
only field2
:
$this->crud->addFields([
['name' => 'field2', 'label' => 'field2 label']
]);
for models with type=type3
both field1
and field2
:
$this->crud->addFields([
['name' => 'field1', 'label' => 'field1 label'],
['name' => 'field2', 'label' => 'field2 label']
]);