MeniV
MeniV
FFilament
Created by MeniV on 2/25/2024 in #❓┊help
Show modal when menuitem clicked
Is it possible (with an action?) to show a modal when klicked on a specific menu-item? Can it be done from the Panel-Provider? The content of the modal will not be related to any Model or Resource.
2 replies
FFilament
Created by MeniV on 12/22/2023 in #❓┊help
Hide relationmanager while viewing infolist
Is it possible to hide a relationmanager (for everyone) when an infolist is viewed? I think some code has to be added to the 'Resource view page' or must it be done by using policies?
4 replies
FFilament
Created by MeniV on 10/24/2023 in #❓┊help
Sorting repeatableEntry
Is it possible to sort a repeatableEntry in an Infolist using data from a relationship? I would like to sort using 'startdate' from a relationship called 'documents':
RepeatableEntry::make('persons') // relationship persons
->schema([
TextEntry::make('datum')
->getStateUsing(fn($record) => $record->documents()->pluck('startdate'))
->date('d-m-Y'),
TextEntry::make('fullname')
->getStateUsing(fn($record) => $record->fullname()),
RepeatableEntry::make('persons') // relationship persons
->schema([
TextEntry::make('datum')
->getStateUsing(fn($record) => $record->documents()->pluck('startdate'))
->date('d-m-Y'),
TextEntry::make('fullname')
->getStateUsing(fn($record) => $record->fullname()),
2 replies
FFilament
Created by MeniV on 10/21/2023 in #❓┊help
Counting relations in infolist
I'm trying to show the nr. of relationships (rows) from a one-to-many relationship on a infolist. Tried a lot, nothing worked. I think it may can be done with a placeholder? How exactly?
6 replies
FFilament
Created by MeniV on 10/11/2023 in #❓┊help
Value in Select component
I see the value in the Select component, but when selected, I only get the array position of the Select component in the database. I want the code as seen in the Documentation where the Select component gives the value:
`'draft' => 'Draft'
`'draft' => 'Draft'
``. How can I best modify this code? Excuse for my poor English...
`->headerActions([
Tables\Actions\CreateAction::make(),
Tables\Actions\AttachAction::make()
->form(fn(AttachAction $action): array => [
$action->getRecordSelect(),
Forms\Components\Select::make('details')->multiple()
->options(function (RelationManager $livewire): array {
return $this->getOwnerRecord()
->getAttribute('eventtype')
->toArray();

}),
]),
])
`->headerActions([
Tables\Actions\CreateAction::make(),
Tables\Actions\AttachAction::make()
->form(fn(AttachAction $action): array => [
$action->getRecordSelect(),
Forms\Components\Select::make('details')->multiple()
->options(function (RelationManager $livewire): array {
return $this->getOwnerRecord()
->getAttribute('eventtype')
->toArray();

}),
]),
])
`
4 replies
FFilament
Created by MeniV on 9/1/2023 in #❓┊help
Pivot table with extra json column
Is there any possibilty to save data (from a [TagsInput]-field) to an extra json column in a pivot table. I get an ErrorException: "Array to string conversion". Do I have to apply a cast somewhere?
12 replies
FFilament
Created by MeniV on 8/28/2023 in #❓┊help
mutateFormDataBeforeSave doesn't initially save to.
I have a model 'Person' with a couple of columns. With mutateFormDataBeforeSave I want to save a concatenation of those columns to another db column named 'fullname'. I use this code which I added to CreatePerson.php & EditPerson.php:
protected function mutateFormDataBeforeSave(array $data): array
{
$fullname_array=array($data['prefix'],$data['fname'],$data['lname'], $data['suffix'], $data['alias']);
$data['fullname'] = implode(" ",$fullname_array);
return $data;
}
protected function mutateFormDataBeforeSave(array $data): array
{
$fullname_array=array($data['prefix'],$data['fname'],$data['lname'], $data['suffix'], $data['alias']);
$data['fullname'] = implode(" ",$fullname_array);
return $data;
}
and the Model:
class Persoon extends Model
{
use HasFactory;
protected $fillable = ['prefix', 'fname', 'lname', 'suffix', 'alias', 'fullname'];
}
class Persoon extends Model
{
use HasFactory;
protected $fillable = ['prefix', 'fname', 'lname', 'suffix', 'alias', 'fullname'];
}
When creating a new Person the fullname doesn't get saved in the db. When (editing) and saving an already created Person the fullname does get (created and) saved. Why doesn't it get saved using CreatePerson.php?
5 replies