-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
24 - Usando componentes do filament fora do painel
- Loading branch information
1 parent
122d277
commit 8825ebe
Showing
4 changed files
with
2,017 additions
and
152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
|
||
namespace App\Livewire; | ||
|
||
use App\Models\Product; | ||
use Livewire\Component; | ||
use Filament\Tables\Table; | ||
use Filament\Forms\Contracts\HasForms; | ||
use Filament\Tables\Columns\TextColumn; | ||
use Filament\Tables\Contracts\HasTable; | ||
use Filament\Forms\Concerns\InteractsWithForms; | ||
use Filament\Tables\Concerns\InteractsWithTable; | ||
|
||
class ListProducts extends Component implements HasForms, HasTable | ||
{ | ||
use InteractsWithTable; | ||
use InteractsWithForms; | ||
|
||
public function table(Table $table): Table | ||
{ | ||
return $table | ||
->query(Product::query()) | ||
->columns([ | ||
TextColumn::make('name'), | ||
TextColumn::make('slug') | ||
->icon('heroicon-o-key') | ||
->searchable(), | ||
TextColumn::make('category.name') | ||
->label('Categoria'), | ||
TextColumn::make('created_at') | ||
->label('Criado em') | ||
->dateTime('d/m/Y h:i') | ||
->sortable() | ||
->toggleable(isToggledHiddenByDefault: false), | ||
TextColumn::make('updated_at') | ||
->label('Atualizado em') | ||
->dateTime('d/m/Y h:i') | ||
->sortable() | ||
->toggleable(isToggledHiddenByDefault: false), | ||
]) | ||
->filters([ | ||
// ... | ||
]) | ||
->actions([ | ||
// ... | ||
]) | ||
->bulkActions([ | ||
// ... | ||
]); | ||
} | ||
|
||
public function render() | ||
{ | ||
return view('livewire.list-products'); | ||
} | ||
} |
Oops, something went wrong.