Bruno
Bruno
FFilament
Created by Bruno on 10/7/2024 in #❓┊help
How to add an Action to the table next to the search?
No description
7 replies
FFilament
Created by Bruno on 10/1/2024 in #❓┊help
Table Repeater in modalContent
I'm having trouble persisting the data from my modal's table repeater after creating my resource. CreateCar. many-to-many relationship
public function getFormActions(): array
{ return [ ...parent::getFormActions(),
Action::make('add example')
->modalContent(fn() => view('modal'))
->modalCancelAction(false)
->modalSubmitAction(false)
];}
public function getFormActions(): array
{ return [ ...parent::getFormActions(),
Action::make('add example')
->modalContent(fn() => view('modal'))
->modalCancelAction(false)
->modalSubmitAction(false)
];}
modal.blade:
<div> @livewire('add-example-modal') </div>
<div> @livewire('add-example-modal') </div>
Class AddExampleModal
class AddExampleModal extends Component implements HasForms, HasActions
{
public ?array $data = [];
public Test $test;

public function mount(Test $test): void
{
$this->test = $test;
$this->form->fill($test->toArray());
$testIds = session('selected_test_ids', []);
session()->forget('selected_test_ids');
}

protected function form(Form $form): Form
{
return $form
->schema([
TableRepeater::make('testes')
->headers([
Header::make(' ')->width('700px'),
])
->schema([
Select::make('test_id')
->getSearchResultsUsing(function (string $search) {
return Test::query()
\\\
});
])
->statePath('data')
->model(Test::class);
}
public function create(): void
{ $test = Test::create($this->form->getState());
$this->form->model($test)->saveRelationships(); }

public function confirmAction(): Action
{
return Action::make('confirm')
->action(function () {
$data = $this->form->getState();
session(['selected_tests' => array_column($data['tests'], 'test_id')]);
});}}
class AddExampleModal extends Component implements HasForms, HasActions
{
public ?array $data = [];
public Test $test;

public function mount(Test $test): void
{
$this->test = $test;
$this->form->fill($test->toArray());
$testIds = session('selected_test_ids', []);
session()->forget('selected_test_ids');
}

protected function form(Form $form): Form
{
return $form
->schema([
TableRepeater::make('testes')
->headers([
Header::make(' ')->width('700px'),
])
->schema([
Select::make('test_id')
->getSearchResultsUsing(function (string $search) {
return Test::query()
\\\
});
])
->statePath('data')
->model(Test::class);
}
public function create(): void
{ $test = Test::create($this->form->getState());
$this->form->model($test)->saveRelationships(); }

public function confirmAction(): Action
{
return Action::make('confirm')
->action(function () {
$data = $this->form->getState();
session(['selected_tests' => array_column($data['tests'], 'test_id')]);
});}}
2 replies
FFilament
Created by Bruno on 9/26/2024 in #❓┊help
preload com getSearchResults
Is there a way to preload a getSearchResults Using or modifyQueryUsing?
3 replies
FFilament
Created by Bruno on 9/24/2024 in #❓┊help
How do I render a livewire modal in my createResource????
I'm having a problem rendering my create button on my form, how do I solve it? My first experience with livewire and filament my code below: Resource:
class ExampleResource extends Resource
{

public static function form(Form $form): Form
{
// form

Modal::make('modal'),

])->columns(1);
}
class ExampleResource extends Resource
{

public static function form(Form $form): Form
{
// form

Modal::make('modal'),

])->columns(1);
}
CreateExample.php:
public function getFormActions(): array
{
return [
...parent::getFormActions(),
Action::make('...')
->color('gray')
->label('...')
->action(function () {
$this->dispatch('open-modal', id: 'addexample');
})
];
}
public function getFormActions(): array
{
return [
...parent::getFormActions(),
Action::make('...')
->color('gray')
->label('...')
->action(function () {
$this->dispatch('open-modal', id: 'addexample');
})
];
}
<x-filament::modal id="addexample width="max-w-5xl">

<div class="w-2/3 rounded-lg">
<form wire:submit="save">
{{ $this->form }}
</form>
</div>
</div>
</x-filament::modal>
<x-filament::modal id="addexample width="max-w-5xl">

<div class="w-2/3 rounded-lg">
<form wire:submit="save">
{{ $this->form }}
</form>
</div>
</div>
</x-filament::modal>
rendering modalexample:
<div>
@livewire('addexample')
</div>
<div>
@livewire('addexample')
</div>
8 replies
FFilament
Created by Bruno on 9/20/2024 in #❓┊help
Modal: Livewire component
No description
6 replies
FFilament
Created by Bruno on 9/13/2024 in #❓┊help
Hiding the super_admin role
Hello everyone, user creation, I have a select with the roles (super_admin, panel_user, manager_user, seller_user), I would like to hide the super_admin information from the other roles. I'm using filament shield plugin. how do I do this?
8 replies
FFilament
Created by Bruno on 9/13/2024 in #❓┊help
I need with Select Edit/View
I have a select where I define the user's role, according to the user's role a type of input appears to fill in, the creation is ok, it saves in the bank, but when editing and viewing the user this dynamic input does not appear, oh no unless I select my role again. In the Select field I am using ->live(). In dynamic fields I am using ->visible() how do I do this?
3 replies
FFilament
Created by Bruno on 9/12/2024 in #❓┊help
Visible with Select, dynamic inputs
I have a select where I define the user's role, according to the user's role, a type of input appears to be filled in, the creation is ok, but in the user's edit and view this dynamic input does not appear. In the Select field I am using ->live(). In dynamic fields I am using ->visible()
5 replies
FFilament
Created by Bruno on 9/11/2024 in #❓┊help
Create and Edit Users Custom input
In the createUsers form, the password field is mandatory, I want the mandatory field to disappear in editUsers.
6 replies
FFilament
Created by Bruno on 9/10/2024 in #❓┊help
Visible Input
Hello, I have a problem. I'm working with a filament plugin (filamentshiled), and I'm assigning the user role through Select. Depending on the user's role, I would like an input to appear. For example: If my user's role was super_admin, a TextInput appears
4 replies
FFilament
Created by Bruno on 9/9/2024 in #❓┊help
Adding a button to the footer of the form
No description
4 replies