uarefans
uarefans
FFilament
Created by uarefans on 10/29/2024 in #❓┊help
How to add custom css class to Specifics resource
Hi, imagine i have UserResource and PostResource. How to add custom css class to PostResource only? My goals actually add custom class in Table Header but i ask AI or read documentation and is not possible, so maybe you can help how to add custom class css to Resource so i can nested class like .custom .fi-header { apply: px-12; } Thank you
9 replies
FFilament
Created by uarefans on 8/5/2023 in #❓┊help
Upgrade v2 to v3, cannot show record and cannot save without error outpput
I try follow documentation step by step upgrade from Filamet v2 to v3, already upgrade livewire 3 and filament 3, i check with composer show my system already using livewire 3 beta and filament 3.0.0. 1. i try using php artisan make:livewire-form Products/EditProduct --edit as sample and form showing but record not show for EditProduct 2. when i try submit nothing happen (can save to database), only in inspect show "Uncaught SyntaxError: unterminated comment livewire.js:8882:1" without any related error message. What supposed to do to fix that? I'm using form builder only without Panel Builder
<?php

namespace App\Livewire\ThemeCategory;

use App\Models\ThemeCategory;
use Filament\Forms;
use Filament\Forms\Concerns\InteractsWithForms;
use Filament\Forms\Contracts\HasForms;
use Filament\Forms\Form;
use Livewire\Component;
use Illuminate\Contracts\View\View;

class Edit extends Component implements HasForms
{
use InteractsWithForms;
public ThemeCategory $record;
public ?array $data = [];

public function mount(ThemeCategory $record): void
{
$this->record = $record;
$this->form->fill($record->toArray());
}

public function form(Form $form): Form
{
return $form
->schema([
Forms\Components\TextInput::make('name'),
Forms\Components\TextInput::make('meta'),
Forms\Components\TextInput::make('opsi'),
])
->statePath('data')
->model($this->record);
}

public function edit(): void
{
$data = $this->form->getState();

$this->record->update($data);
}

public function render(): View
{
return view('livewire.theme-category.edit');
}
}
<?php

namespace App\Livewire\ThemeCategory;

use App\Models\ThemeCategory;
use Filament\Forms;
use Filament\Forms\Concerns\InteractsWithForms;
use Filament\Forms\Contracts\HasForms;
use Filament\Forms\Form;
use Livewire\Component;
use Illuminate\Contracts\View\View;

class Edit extends Component implements HasForms
{
use InteractsWithForms;
public ThemeCategory $record;
public ?array $data = [];

public function mount(ThemeCategory $record): void
{
$this->record = $record;
$this->form->fill($record->toArray());
}

public function form(Form $form): Form
{
return $form
->schema([
Forms\Components\TextInput::make('name'),
Forms\Components\TextInput::make('meta'),
Forms\Components\TextInput::make('opsi'),
])
->statePath('data')
->model($this->record);
}

public function edit(): void
{
$data = $this->form->getState();

$this->record->update($data);
}

public function render(): View
{
return view('livewire.theme-category.edit');
}
}
<div>
<form wire:submit="edit">
{{ $this->form }}

<button type="submit">
Submit
</button>
</form>

<x-filament-actions::modals />
</div>
<div>
<form wire:submit="edit">
{{ $this->form }}

<button type="submit">
Submit
</button>
</form>

<x-filament-actions::modals />
</div>
3 replies
FFilament
Created by uarefans on 8/2/2023 in #❓┊help
Relationship User & Role
i have 3 table users roles user_role user 1 UserA 2 UserB role 1 Admin 2 Marketing user_role user_id role_id 1 1 1 2 2 2 meaning UserA have roles admin and marketing, User B just Marketing Model user roles() with belongsToMany I want select multiple dropdown in the User edit forms using Form Builder, i try using docs 2.x version 1. first problem cannot see roles for UserA or UserB 2. second problem, how to save to table user_role ? my last code using native livewire using synch, can we done with filament? thank you before
1 replies