Skip to content

Commit

Permalink
24 - Usando componentes do filament fora do painel
Browse files Browse the repository at this point in the history
  • Loading branch information
elton-fonseca committed Nov 1, 2024
1 parent 122d277 commit 8825ebe
Show file tree
Hide file tree
Showing 4 changed files with 2,017 additions and 152 deletions.
56 changes: 56 additions & 0 deletions app/Livewire/ListProducts.php
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');
}
}
Loading

0 comments on commit 8825ebe

Please sign in to comment.