mirror of
https://github.com/filamentphp/filament.git
synced 2026-10-24 23:35:30 +08:00
Merge pull request #6435 from linaspasv/patch-1
Allows single column condition in Searchable
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user