Merge pull request #6435 from linaspasv/patch-1

Allows single column condition in Searchable
This commit is contained in:
Dan Harrin
2023-05-06 09:09:07 +01:00
committed by GitHub
@@ -3,6 +3,7 @@
namespace Filament\Tables\Columns\Concerns;
use Closure;
use Illuminate\Support\Arr;
use Illuminate\Support\Str;
trait CanBeSearchable
@@ -18,17 +19,17 @@ trait CanBeSearchable
protected ?Closure $searchQuery = null;
public function searchable(
bool | array $condition = true,
bool | array | string $condition = true,
?Closure $query = null,
bool $isIndividual = false,
bool $isGlobal = true,
): static {
if (is_array($condition)) {
$this->isSearchable = true;
$this->searchColumns = $condition;
} else {
if (is_bool($condition)) {
$this->isSearchable = $condition;
$this->searchColumns = null;
} else {
$this->isSearchable = true;
$this->searchColumns = Arr::wrap($condition);
}
$this->isGloballySearchable = $isGlobal;