Clement
Clement
FFilament
Created by Clement on 7/1/2024 in #❓┊help
CreateOptionUsing Exception
Resolved the problem came from JS part where they don't know what was tag
12 replies
FFilament
Created by Clement on 7/1/2024 in #❓┊help
CreateOptionUsing Exception
I have reupdated the source code on my last comment
12 replies
FFilament
Created by Clement on 7/1/2024 in #❓┊help
CreateOptionUsing Exception
Okay I also have tried without multiple, it works perfectly, but when I had multiple() it does not works anymore on creation process
12 replies
FFilament
Created by Clement on 7/1/2024 in #❓┊help
CreateOptionUsing Exception
Yes it was for my previous test I set it to : $this->form->fill([]);
12 replies
FFilament
Created by Clement on 7/1/2024 in #❓┊help
CreateOptionUsing Exception
Form Builder
<?php

namespace App\Livewire\Organisation;

use App\Models\Team;
use Filament\Forms\Components\ColorPicker;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Concerns\InteractsWithForms;
use Filament\Forms\Contracts\HasForms;
use Filament\Forms\Form;
use Livewire\Component;

class TagManager extends Component implements HasForms
{
use InteractsWithForms;

public Team $team;


public function form(Form $form): Form
{
return $form
->schema([
Select::make('tag')
->multiple()
->options(function (callable $get) {
return $this->team->tags()->pluck('name', 'id')->toArray();
})
->model(Team::class)
->relationship('tags', 'name')
->createOptionForm([
TextInput::make('name')
->required(),
ColorPicker::make('color')
->hex()
->default('#000000')
])
->createOptionUsing(function (array $data) {
return auth()->user()->currentTeam->tags()->create($data)->getKey();
})
]);
}

public function mount(): void
{
$this->form->fill([
'tag' => $this->team->tags->pluck('id')->toArray(),
]);
}

public function render()
{
return view('components.Organisation.tag-manager');
}
}
<?php

namespace App\Livewire\Organisation;

use App\Models\Team;
use Filament\Forms\Components\ColorPicker;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Concerns\InteractsWithForms;
use Filament\Forms\Contracts\HasForms;
use Filament\Forms\Form;
use Livewire\Component;

class TagManager extends Component implements HasForms
{
use InteractsWithForms;

public Team $team;


public function form(Form $form): Form
{
return $form
->schema([
Select::make('tag')
->multiple()
->options(function (callable $get) {
return $this->team->tags()->pluck('name', 'id')->toArray();
})
->model(Team::class)
->relationship('tags', 'name')
->createOptionForm([
TextInput::make('name')
->required(),
ColorPicker::make('color')
->hex()
->default('#000000')
])
->createOptionUsing(function (array $data) {
return auth()->user()->currentTeam->tags()->create($data)->getKey();
})
]);
}

public function mount(): void
{
$this->form->fill([
'tag' => $this->team->tags->pluck('id')->toArray(),
]);
}

public function render()
{
return view('components.Organisation.tag-manager');
}
}
12 replies
FFilament
Created by Clement on 7/1/2024 in #❓┊help
CreateOptionUsing Exception
12 replies
FFilament
Created by Clement on 2/26/2024 in #❓┊help
Can't receive relationship data on a form createAction
@Dennis Koch ? 🙂
4 replies
FFilament
Created by Clement on 2/26/2024 in #❓┊help
Can't receive relationship data on a form createAction
my schema:
protected function workspaceSchema(): array
{
return [
TextInput::make('name')
->columnSpan(2)
->label('WorkSpace Name')
->placeholder('Enter the name of the workspace')
->live(debounce: 500)
->afterStateUpdated(fn (Set $set, ?string $state) => $set('slug', Str::slug($state))),
TextInput::make('available_space')
->columnSpan(1)
->label('Space Available')
->numeric()
->inputMode('decimal')
->placeholder('Enter the space available in the workspace')
->extraInputAttributes([
'min' => 0,
])
->rules(['gt:0']),
TextInput::make('slug')
->readOnly()
->required()
->unique(TeamWorkSpace::class, 'slug', ignoreRecord: true),
Select::make('metiers')
->label('Add jobs access to this workspace')
->relationship('metiers')
->options(
$this->team->metiers()->get()->pluck('name', 'id')
)
->searchable()
->multiple()
->columnSpan(2)
];
}
protected function workspaceSchema(): array
{
return [
TextInput::make('name')
->columnSpan(2)
->label('WorkSpace Name')
->placeholder('Enter the name of the workspace')
->live(debounce: 500)
->afterStateUpdated(fn (Set $set, ?string $state) => $set('slug', Str::slug($state))),
TextInput::make('available_space')
->columnSpan(1)
->label('Space Available')
->numeric()
->inputMode('decimal')
->placeholder('Enter the space available in the workspace')
->extraInputAttributes([
'min' => 0,
])
->rules(['gt:0']),
TextInput::make('slug')
->readOnly()
->required()
->unique(TeamWorkSpace::class, 'slug', ignoreRecord: true),
Select::make('metiers')
->label('Add jobs access to this workspace')
->relationship('metiers')
->options(
$this->team->metiers()->get()->pluck('name', 'id')
)
->searchable()
->multiple()
->columnSpan(2)
];
}
The problem is located with my Select::make('metiers') where i use it for my relation "metiers" When I remove relationship I can get in $data metiers also Multiple is not populated with already linked "metiers" on edit
4 replies
FFilament
Created by Clement on 2/15/2024 in #❓┊help
Select Multiple always active
also just the select is always active state even when I enter in the modal it's already active. I don't have to click on it
21 replies
FFilament
Created by Clement on 2/15/2024 in #❓┊help
Select Multiple always active
the event and refresh is working well
21 replies
FFilament
Created by Clement on 2/15/2024 in #❓┊help
Select Multiple always active
Yes I am using filament v3
21 replies
FFilament
Created by Clement on 2/15/2024 in #❓┊help
Select Multiple always active
No description
21 replies
FFilament
Created by Clement on 2/15/2024 in #❓┊help
Select Multiple always active
No description
21 replies
FFilament
Created by Clement on 2/15/2024 in #❓┊help
Select Multiple always active
No description
21 replies
FFilament
Created by Clement on 2/15/2024 in #❓┊help
Select Multiple always active
Why do I need actions ? Need to add it directly my select component ?
21 replies
FFilament
Created by Clement on 2/15/2024 in #❓┊help
Select Multiple always active
I don't have any Action registered
21 replies
FFilament
Created by Clement on 2/15/2024 in #❓┊help
Select Multiple always active
Also When I create it works perfectly with my event listener, I think it's a style issue with my select multiple mmh
21 replies
FFilament
Created by Clement on 2/15/2024 in #❓┊help
Select Multiple always active
No description
21 replies
FFilament
Created by Clement on 2/15/2024 in #❓┊help
Select Multiple always active
No description
21 replies