Workflow
Filters Outside

This example shows Filters "Outside".

(This Table is a variation of the "Filter Inline" example.)

ID
Dish
Calories
Category
Chef
Price
Diet
In Stock
Created At
ID
Dish
Calories
Category
Chef
Price
Diet
In Stock
Created At
1
Arkansas Possum Pie
434 kcal
Soup
Vitor
R$ 118,08
🥜 Suitable for Celiacs
Out of Stock
26/09/2024
2
Albacore Tuna Melt
828 kcal
Pasta
Claudio
R$ 132,75
🍽️ All diets
Out of Stock
07/10/2024
3
борщ
391 kcal
Soup
Dan
R$ 100,19
🍽️ All diets
In Stock
26/09/2024
4
Bacalhau com natas
573 kcal
Dessert
R$ 208,60
🥜 Suitable for Celiacs
Out of Stock
29/09/2024
5
Baba Ghanoush
735 kcal
Soup
Luan
R$ 183,81
🥜 Suitable for Celiacs
Out of Stock
03/10/2024
6
Bacon Cheeseburger
806 kcal
Soup
R$ 137,48
🍽️ All diets
Out of Stock
11/09/2024
7
Baked potato
534 kcal
Pasta
Luan
R$ 189,66
🥜 Suitable for Celiacs
In Stock
03/10/2024
8
Baklava
750 kcal
Pie
R$ 161,92
🍽️ All diets
In Stock
12/10/2024
9
Bangers and mash
203 kcal
Pie
Luan
R$ 214,04
🌱 Suitable for Vegans
In Stock
03/10/2024
10
Black Pudding
330 kcal
Pasta
R$ 116,13
🥜 Suitable for Celiacs
In Stock
02/10/2024
Disclaimer: Table data is randomly generated for illustrative purposes only. The information here is not a reflection of the actual market and does not constitute business, financial, or medical advice.
<?php
 
namespace App\Livewire\Examples\FiltersOutsideTable;
 
use App\Livewire\Examples\FiltersInlineTable\FiltersInlineTable;
use App\Models\Dish;
use Illuminate\Database\Eloquent\Builder;
use PowerComponents\LivewirePowerGrid\Facades\PowerGrid;
 
final class FiltersOutsideTable extends FiltersInlineTable
{
public string $tableName = 'filters-outside-table';
 
public bool $showFilters = true;
 
public function boot(): void
{
config(['livewire-powergrid.filter' => 'outside']);
}
 
public function setUp(): array
{
return [
PowerGrid::header()
->showToggleColumns()
->withoutLoading()
->showSearchInput(),
 
PowerGrid::footer()
->showPerPage()
->showRecordCount(),
];
}
 
public function datasource(): Builder
{
return Dish::query()
->when(
$this->categoryId,
fn ($builder) => $builder->whereHas(
'category',
fn ($builder) => $builder->where('category_id', $this->categoryId)
)
->with(['category', 'kitchen'])
);
}
}
Code highlighting provided by Torchlight.dev