\
\
FFilament
Created by \ on 4/14/2024 in #❓┊help
Import Action not working
Hey, I've been trying to use the import action in my application. However each time I try to upload the csv file for import I keep getting the same error. TypeError PHP 8.2.4 10.48.2 Filament\Actions\ImportAction::Filament\Actions\Concerns{closure}(): Argument #2 ($state) must be of type ?Livewire\Features\SupportFileUploads\TemporaryUploadedFile, array given, called in path\vendor\filament\support\src\Concerns\EvaluatesClosures .php on line 35 I've published all the neccessary tables as stated in the documentation and I haven't tampered with the vendor folder in any way. The problem doesn't seem to be caused by my csv file as I've tried importing my data to the filament demo where it worked perfectly. Any help would be of great help
3 replies
FFilament
Created by \ on 3/21/2024 in #❓┊help
Multiple relation managers on manage related records page
No description
2 replies
FFilament
Created by \ on 3/19/2024 in #❓┊help
Fail validation for multiple fields
Is it possible to simultaneously trigger validation failures for multiple fields when a specific condition is met in just one of those fields? While I'm familiar with the $fail closure function, I've only been able to get it to fail the field in which it's been called.
// First field
DatePicker::make('contract_start')
->rules([
fn (): Closure => function (string $attribute, $value, Closure $fail) {
if ($condition) {
$fail("Incorrect values passed.");
})
]),
// Second field
DatePicker::make('contract_end')
->rules([
fn (): Closure => function (string $attribute, $value, Closure $fail) {
if ($another_condition) {
$fail("Incorrect values passed.");
})
]),
// First field
DatePicker::make('contract_start')
->rules([
fn (): Closure => function (string $attribute, $value, Closure $fail) {
if ($condition) {
$fail("Incorrect values passed.");
})
]),
// Second field
DatePicker::make('contract_end')
->rules([
fn (): Closure => function (string $attribute, $value, Closure $fail) {
if ($another_condition) {
$fail("Incorrect values passed.");
})
]),
2 replies
FFilament
Created by \ on 2/23/2024 in #❓┊help
Searching for values in hidden columns
Hey, I have columns in my table that are set as hidden, but I still want to be able to search for values within those columns. I've tried to modify the applySearchToTableQuery() and applyColumnSearchesToTableQuery() methods as per the documentation, but it doesn't seem to work. These functions are located directly above my table function. These functions are located in my EventsResource directly above the table function.
protected function applySearchToTableQuery(Builder $query): Builder
{
$this->applyColumnSearchesToTableQuery($query);

if (filled($search = $this->getTableSearch())) {
$query->whereIn('attendances.employee.name', Event::search($search)->keys());
}

return $query;
}
protected function applySearchToTableQuery(Builder $query): Builder
{
$this->applyColumnSearchesToTableQuery($query);

if (filled($search = $this->getTableSearch())) {
$query->whereIn('attendances.employee.name', Event::search($search)->keys());
}

return $query;
}
protected function applyColumnSearchesToTableQuery(Builder $query): Builder
{
foreach ($this->getTableColumnSearches() as $column => $search) {
if (blank($search)) {
continue;
}

$column = $this->getTable()->getColumn($column);

if (! $column) {
continue;
}

// COMMENTED
//if ($column->isHidden()) {
// continue;
//}

if (! $column->isIndividuallySearchable()) {
continue;
}

foreach ($this->extractTableSearchWords($search) as $searchWord) {
$query->where(function (Builder $query) use ($column, $searchWord) {
$isFirst = true;

$column->applySearchConstraint(
$query,
$searchWord,
$isFirst,
);
});
}
}
}
protected function applyColumnSearchesToTableQuery(Builder $query): Builder
{
foreach ($this->getTableColumnSearches() as $column => $search) {
if (blank($search)) {
continue;
}

$column = $this->getTable()->getColumn($column);

if (! $column) {
continue;
}

// COMMENTED
//if ($column->isHidden()) {
// continue;
//}

if (! $column->isIndividuallySearchable()) {
continue;
}

foreach ($this->extractTableSearchWords($search) as $searchWord) {
$query->where(function (Builder $query) use ($column, $searchWord) {
$isFirst = true;

$column->applySearchConstraint(
$query,
$searchWord,
$isFirst,
);
});
}
}
}
I've attempted some modifications, but it doesn't seem to work. The functions are not even being activated by a search query, as I tested with dd(). Any kind of help would be appreciated
3 replies