protected $_columnType = 'check';
protected $_cast = 'boolean';
protected $_viewNamespace = 'toggle-field-for-backpack::fields';
- protected $_filterType = 'simple';
+ protected $_filterType = 'dropdown';
public function filterDefault($value)
{
return $value ? '1' : '0';
}
+ public function getFilterValues()
+ {
+ return ['1' => __('Oui'), '0' => __('Non')];
+ }
+
+
}
$crud->addClause('where', $name, '1');
} else if ($type === 'dropdown' || $type === 'select2') {
if ($this->getAttribute('allows_multiple')) {
- if(is_array($value)){
- $value=json_encode($value);
+ if (is_array($value)) {
+ $value = json_encode($value);
}
- $crud->addClause('where', $name, 'isnotnull');
+ $crud->addClause('whereNotNull', $name);
$crud->addClause('where', $name, 'like', '%"' . $value . '"%');
} else {
$crud->addClause('where', $name, $value);