A7med_khalid
A7med_khalid
FFilament
Created by A7med_khalid on 5/7/2024 in #❓┊help
Can i use filament form getters and setters in custom page?
Forms\Components\Grid::make()
->schema([
Forms\Components\Select::make('from_warehouse_id')
->label(self::$resource::$langFile . '.warehouse')
->options(fn () => Warehouse::pluck('name', 'id'))
->live()
// ->searchable()
->required(),
Forms\Components\Select::make('to_warehouse_id')
->label(self::$resource::$langFile . '.warehouse')
->options(fn (Forms\Get $get) => Warehouse::pluck('name', 'id')->filter(fn ($value, $key) => $key != $get('from_warehouse_id')))
->disabled(fn(Forms\Get $get) => dd($get('*', true)))
// ->disabled(fn(Forms\Get $get) => !filled($get('from_warehouse_id')))
// ->searchable()
->required(),
]),
Forms\Components\Grid::make()
->schema([
Forms\Components\Select::make('from_warehouse_id')
->label(self::$resource::$langFile . '.warehouse')
->options(fn () => Warehouse::pluck('name', 'id'))
->live()
// ->searchable()
->required(),
Forms\Components\Select::make('to_warehouse_id')
->label(self::$resource::$langFile . '.warehouse')
->options(fn (Forms\Get $get) => Warehouse::pluck('name', 'id')->filter(fn ($value, $key) => $key != $get('from_warehouse_id')))
->disabled(fn(Forms\Get $get) => dd($get('*', true)))
// ->disabled(fn(Forms\Get $get) => !filled($get('from_warehouse_id')))
// ->searchable()
->required(),
]),
when dumping all get values i get null
>disabled(fn(Forms\Get $get) => dd($get('*', true)))
>disabled(fn(Forms\Get $get) => dd($get('*', true)))
5 replies
FFilament
Created by A7med_khalid on 4/23/2024 in #❓┊help
Saving repeater without using the saveRelationShipUsing
Hi, I have a repeater with nested relations the repeater does not save it right because every model consist of more than table so i need to save it using custom code in SaveRelationUsing it is working now but this pattern repeater in multiple resources so i need to extract this logic to afterSave hook but the issue is the repeater values is not present in $data array Is there any way to access the updated values of repeater fields in after or before save hooks?
17 replies
FFilament
Created by A7med_khalid on 12/11/2023 in #❓┊help
Customizing relation manager actions
I need to customize create action behavior but can not find anything in the documentation, i found this in RelationManager class and tried using it but it did not work $this->configureCreateAction($action);
3 replies
FFilament
Created by A7med_khalid on 12/3/2023 in #❓┊help
Using JS in a filament custom form component
Hello, What I am trying to do: Trying to run JS in filament custom form component What I did: I included script tags with console logs in the component but it never triggers i tried including the scripts using @push and directly but both did not work. My issue/the error: The Js is not triggering in filament custom component Code:
<x-dynamic-component
:component="$getFieldWrapperView()"
:field="$field"
>
<div x-data="{ state: $wire.$entangle('{{ $getStatePath() }}') }">
<!-- Interact with the `state` property in Alpine.js -->

<input type="file" id="directoryInput" wire:model="{{ $getStatePath() }}.folder[]" webkitdirectory multiple>
<div wire:loading wire:target="{{ $getStatePath() }}.folder[]">Uploading...</div>




</div>
<script>
console.log("hello");
document.addEventListener('livewire:load', function () {
console.log("hello");

})
document.getElementById("directoryInput").addEventListener(
"change",
(event) => {
var names = [];
for (const file of event.target.files) {
names.push(file.webkitRelativePath);
}

console.log(names);

},
false,
);
</script>

</x-dynamic-component>
<x-dynamic-component
:component="$getFieldWrapperView()"
:field="$field"
>
<div x-data="{ state: $wire.$entangle('{{ $getStatePath() }}') }">
<!-- Interact with the `state` property in Alpine.js -->

<input type="file" id="directoryInput" wire:model="{{ $getStatePath() }}.folder[]" webkitdirectory multiple>
<div wire:loading wire:target="{{ $getStatePath() }}.folder[]">Uploading...</div>




</div>
<script>
console.log("hello");
document.addEventListener('livewire:load', function () {
console.log("hello");

})
document.getElementById("directoryInput").addEventListener(
"change",
(event) => {
var names = [];
for (const file of event.target.files) {
names.push(file.webkitRelativePath);
}

console.log(names);

},
false,
);
</script>

</x-dynamic-component>
3 replies