Alvika Aji Prahasta
Repeater Get Value from outside schema
Hi, how to get client_id_repeater, from outside to afterStateHydrated repeater, thanks
TextInput::make('client_id_repeater')->live(),
Repeater::make('responses')
->schema([
])->deletable(false)->addable(false)->reorderable(false)
->columns(1)
->defaultItems(0)
->afterStateHydrated(function (Repeater $component, $state, ?Model $record, Get $get) {
if (!empty($state)) {
return;
}
$clientId = $get('client_id_repeater');
}
})
3 replies
Create new component have an error
hello seek help, i've component with livewire, this is the code:
<?php
namespace App\Livewire;
use Livewire\Component;
class RefreshWarning extends Component
{
public $data;
public function __construct(
protected string $name,
) {}
public static function make(string $name): self
{
return new self($name);
}
public function mount($data = null)
{
$this->data = $data;
}
public static function canView(): bool
{
return true;
}
public function render()
{
return view('livewire.refresh-warning');
}
}
when i call that component like this:
RefreshWarning::make($this->isActive)
have error:
Filament\Forms\ComponentContainer::Filament\Forms\Concerns{closure}(): Argument #1 ($component) must be of type Filament\Forms\Components\Component, App\Livewire\RefreshWarning given
please help me:( i'm stuck on 3days3 replies
Unable to find component: [app.filament.widgets.kickoff-property-table-widget]
Seek Help, i've code like this, but have some errors, when i create di kickoff the result Unable to find component: [app.filament.widgets.kickoff-property-table-widget] but that data success input to database
App\Filament\Widgets\KickoffPropertyTableWidget.php
<?php
namespace App\Filament\Widgets;
use App\Models\KickoffProperty;
use Filament\Widgets\TableWidget as BaseWidget;
class KickoffPropertyTableWidget extends BaseWidget
{
public $data;
public function mount($data = null)
{
$this->data = $data;
}
protected $listeners = ['refreshScorecardTable' => '$refresh'];
public function table(Table $table): Table
{
return $table
->query(
KickoffProperty::query()
)
->columns([
])
->paginated(false);
}
}
App\Filament\Resources\JourneyResource\Pages\CreateJourney.php
Step::make('Kickoff Property')
->schema([
Actions::make([
Action::make('Create Kickoff Property')
->form([
])
->action(function (array $data, Get $get, $livewire) {
$kickOff = new KickoffProperty;
$kickOff->save();
// Refresh the table data
$livewire->dispatch('refreshScorecardTable');
}),
]),
View::make('kicoffTable')
->view('filament.widgets.kickoff-property-table-widget')
])
views\filament\widgets\kickoff-property-table-widget.blade.php
<div>
@livewire(\App\Filament\Widgets\KickoffPropertyTableWidget::class, [
'data' => $this->data['data_result_investment_schema'] ?? [],
])
</div>
3 replies
Using Sushi for table with static data error
Seek help, when i following this https://filamentphp.com/community/how-to-consume-an-external-api-with-filament-tables
i've error:
SQLSTATE[HY000]: General error: 1 all VALUES must have the same number of terms (Connection: , SQL: insert into "products" ("brand", "category", "description", "id", "price", "rating", "thumbnail", "title") values (Essence, beauty, The Essence Mascara Lash Princess is a popular mascara known for its volumizing and lengthening effects. Achieve dramatic lashes with this long-lasting and cruelty-free formula., 1, 9.99, 4.94, https://cdn.dummyjson.com/products/images/beauty/Essence%20Mascara%20Lash%20Princess/thumbnail.png, Essence Mascara Lash Princess),
I've done following all stuff but still not working
5 replies
Table TextInputColumn Update Other Model
hi guys seek help, Is it possible to update data from another model? For example, in this code:
php
Copy code
class ScorecardTableWidget extends BaseWidget
{
protected $listeners = ['refreshScorecardTable' => '$refresh'];
public function table(Table $table): Table
{
$properties = ScorecardProperty::all();
$columns = [
Tables\Columns\TextColumn::make('name')
->label('Criteria'),
Tables\Columns\TextInputColumn::make('weightage'),
];
foreach ($properties as $property) {
$columns[] = Tables\Columns\TextInputColumn::make("score_{$property->id}")
->label($property->name)
->beforeStateUpdated(function ($record, $state) use ($property) {
ScorecardScore::updateOrCreate(
[
'scorecard_property_id' => $property->id,
'scorecard_criteria_id' => $record->id,
],
['score' => $state]
);
$this->dispatch('refreshScorecardTable');
});
}
return $table->query(ScorecardCriteria::query())
->columns($columns);
}
}
7 replies