Closed xhevatziberi closed 5 years ago
@xhevattalenta sharing a bit more code could help, thanks.
P.S. I would like to see the output of $this->scaffoldFilters()
and the rest of filters
method.
Here are the columns of the model
a snippet from
scaffoldFilters
function in Traits\Module\HasFilters.php
for this model.
The indexes are of type "BigIntType" and it doesnt satisfy none of the conditions of the switch statement in: https://github.com/adminarchitect/core/blob/34569401a24661f3ef74cbbbb158b98ae41975c7/src/Traits/Module/HasFilters.php#L87 maybe here is the issue?
Here is how I use the filters:
public function filters()
{
return $this->scaffoldFilters()
->update("client_id", function ($control) {
$control->getInput()
->setQuery(function ($query, $value) {
return $query
->join('clients as c', 'c.id', '=', 'mounts.client_id')
->where('c.name', $value);
});
return $control;
});
}
@xhevattalenta it seems that client_id
is not auto-discovered by AdminArchitect as a filter (because of Int type). You have to register it (push
) as a filter instead of updating. update
means you have added a filter before or it was added by AdminArchitect
@xhevattalenta it seems that
client_id
is not auto-discovered by AdminArchitect as a filter (because of Int type). You have to register it (push
) as a filter instead of updating.update
means you have added a filter before or it was added by AdminArchitect
Yes that does the trick. The filter can be added and updated by chaining the methods which is great.
public function filters() { return $this->scaffoldFilters()->update('phone', ...
throws an error "Element [phone] does not exist." even if it is present. Another issue for the update is that the control doesn't have asetQuery
method, even if in the docs there is an example for filtering relationships that way.