save filter data in variable

in my code i want to save choosen filter in my variable like i have $status variable and i want to save there this

protected function getFilters(): ?array
{
return [
null => 'Show All',
0 => 'In Progress',
1 => 'Order',
2 => 'Completed',
3 => 'Cancelled',
];
}

protected function getFilters(): ?array
{
return [
null => 'Show All',
0 => 'In Progress',
1 => 'Order',
2 => 'Completed',
3 => 'Cancelled',
];
}
if i choose in Progress i want to save 0 in $status
10 Replies
toeknee
toeknee3mo ago
Can you explain your goal more?
gigiloouu
gigiloouuOP3mo ago
i have purchases table
$query = Purchase::where('supplier_id', $this->supplierId)
$query = Purchase::where('supplier_id', $this->supplierId)
and im taiiking data like this next i take data frm purchase using status
if ($this->status !== null) { // Handle filtering by status
$query->where('status', $this->filters);
}
if ($this->status !== null) { // Handle filtering by status
$query->where('status', $this->filters);
}
public ?int $status = null; // Change to int to match status values
public ?int $status = null; // Change to int to match status values
i have status variable like this i want to use it to get puurchases items where stattus == my status variable i create filter in my widget like this
protected function getFilters(): ?array
{
return [
null => 'Show All',
0 => 'In Progress',
1 => 'Order',
2 => 'Completed',
3 => 'Cancelled',
];
}
protected function getFilters(): ?array
{
return [
null => 'Show All',
0 => 'In Progress',
1 => 'Order',
2 => 'Completed',
3 => 'Cancelled',
];
}
and i want when i select in progress save 0 in status variable and use it to take purchases items where status === 0 u get it?
toeknee
toeknee3mo ago
If you have created a filter it will filter the table by the selected value.... But where are you wanting to save it? I am not understanding.
gigiloouu
gigiloouuOP3mo ago
look i have chart widget
gigiloouu
gigiloouuOP3mo ago
No description
gigiloouu
gigiloouuOP3mo ago
which have filter in right side
protected function getFilters(): ?array
{
return [
null => 'Show All',
0 => 'In Progress',
1 => 'Order',
2 => 'Completed',
3 => 'Cancelled',
];
}
protected function getFilters(): ?array
{
return [
null => 'Show All',
0 => 'In Progress',
1 => 'Order',
2 => 'Completed',
3 => 'Cancelled',
];
}
this filter and i want like if i select In progress i want to take data from purchases where status == selected status
gigiloouu
gigiloouuOP3mo ago
?? anyone please?
toeknee
toeknee3mo ago
So you want to filter the resource data from the widget filter form? Is that correct?
gigiloouu
gigiloouuOP3mo ago
yes i have filter for my widget anyone can helpme?
Want results from more Discord servers?
Add your server