Fix transaction table scope to my portfolios only (#184)
* Limit transactions table filters to `my portfolios` scope * Fix scope of transactions table
This commit is contained in:
@@ -41,7 +41,13 @@ class TransactionsTable extends Component implements HasActions, HasSchemas, Has
|
|||||||
'SELL' => 'SELL',
|
'SELL' => 'SELL',
|
||||||
]),
|
]),
|
||||||
SelectFilter::make('portfolio')
|
SelectFilter::make('portfolio')
|
||||||
->relationship('portfolio', 'title', fn (Builder $query) => $query->myPortfolios()),
|
->relationship('portfolio', 'title', fn (Builder $query) => $query->myPortfolios())
|
||||||
|
->query(function (Builder $query, array $data): Builder {
|
||||||
|
return $query->when(
|
||||||
|
$data['value'],
|
||||||
|
fn (Builder $query, $value) => $query->portfolio($value)
|
||||||
|
);
|
||||||
|
}),
|
||||||
])
|
])
|
||||||
->deferFilters(false)
|
->deferFilters(false)
|
||||||
->query(
|
->query(
|
||||||
|
|||||||
Reference in New Issue
Block a user