Christophe
Christophe
FFilament
Created by Christophe on 11/7/2024 in #❓┊help
Custom form component
I found it. Not sure if it's the right way, but it does work. I update the record when the state is changed in my Resource file:
MainSubjectSelect::make('main_subject_id')
->label('Hoofdonderwerp')
->columnSpanFull()
->statePath('main_subject_id')
->afterStateUpdated(function ($state, $record) {
$record->main_subject_id = $state;
$record->save();
}),
MainSubjectSelect::make('main_subject_id')
->label('Hoofdonderwerp')
->columnSpanFull()
->statePath('main_subject_id')
->afterStateUpdated(function ($state, $record) {
$record->main_subject_id = $state;
$record->save();
}),
4 replies
FFilament
Created by Christophe on 11/7/2024 in #❓┊help
Custom form component
So I guess I have to bind the new clicked value (in this case an id) to the state-variable, which works, but it doesnt update when submitting the form
4 replies
FFilament
Created by Christophe on 11/7/2024 in #❓┊help
Custom form component
My Livewire component:
<div
x-data="{
open: false,
isFocused: false,
currentSubject: null,
}"
>
<div
@click="open = !open"
@focusin="isFocused = true"
@focusout="isFocused = false"
>
<div class="flex-1 min-w-0">
<span x-text="currentSubject ? currentSubject : 'Selecteer een onderwerp'"></span>
</div>
</div>
<div
x-show="open"
x-cloak
x-on:click.away="open = false"
class="absolute z-10"
>
@foreach($subjects as $subject)
<div class="flex flex-col px-4 py-2 rounded-lg"
x-data="{ expanded: false }" >
<div class="flex justify-between space-x-8" >
<span
@click="
state = '{{ $subject['id'] }}';
currentSubject = '{{ $subject['title'] }}';
open = false;
>
{{ $subject['title'] }}
</span>
@if($subject['hasChildren'])
<span
:class="{ 'transform rotate-180': expanded }"
@click="expanded = !expanded"
wire:click='toggleItem({{ $subject['id'] }})'
>
+
</span>
@endif
</div>
<div
x-show="expanded"
x-transition
class="p-2"
>
@foreach($children[$subject['id']] ?? [] as $child)
<x-subject-node :subject="$child" :expandedItems="$expandedItems" :children="$children" :key="$child['id']" />
@endforeach
</div>
</div>
@endforeach
</div>
</div>
<div
x-data="{
open: false,
isFocused: false,
currentSubject: null,
}"
>
<div
@click="open = !open"
@focusin="isFocused = true"
@focusout="isFocused = false"
>
<div class="flex-1 min-w-0">
<span x-text="currentSubject ? currentSubject : 'Selecteer een onderwerp'"></span>
</div>
</div>
<div
x-show="open"
x-cloak
x-on:click.away="open = false"
class="absolute z-10"
>
@foreach($subjects as $subject)
<div class="flex flex-col px-4 py-2 rounded-lg"
x-data="{ expanded: false }" >
<div class="flex justify-between space-x-8" >
<span
@click="
state = '{{ $subject['id'] }}';
currentSubject = '{{ $subject['title'] }}';
open = false;
>
{{ $subject['title'] }}
</span>
@if($subject['hasChildren'])
<span
:class="{ 'transform rotate-180': expanded }"
@click="expanded = !expanded"
wire:click='toggleItem({{ $subject['id'] }})'
>
+
</span>
@endif
</div>
<div
x-show="expanded"
x-transition
class="p-2"
>
@foreach($children[$subject['id']] ?? [] as $child)
<x-subject-node :subject="$child" :expandedItems="$expandedItems" :children="$children" :key="$child['id']" />
@endforeach
</div>
</div>
@endforeach
</div>
</div>
4 replies
FFilament
Created by Christophe on 9/9/2024 in #❓┊help
Custom page messing up sidebar
It is though but it was not quite clear to me how I could solve it otherwise
18 replies
FFilament
Created by Christophe on 9/9/2024 in #❓┊help
Custom page messing up sidebar
task('deploy:build', function () {
run('cd {{release_path}} && npm run build');
});
task('deploy:build', function () {
run('cd {{release_path}} && npm run build');
});
18 replies
FFilament
Created by Christophe on 9/9/2024 in #❓┊help
Custom page messing up sidebar
It was the easiest fix I could find. Would this be better? https://filamentphp.com/docs/3.x/panels/themes#creating-a-custom-theme
18 replies
FFilament
Created by Christophe on 9/9/2024 in #❓┊help
Custom page messing up sidebar
FYI: this is the deploy package I'm using: https://deployer.org/
18 replies
FFilament
Created by Christophe on 9/9/2024 in #❓┊help
Custom page messing up sidebar
Yes it worked but I'm not sure why I should build it afterwards on the server if I'm building it first with my deploy script. I will look into it. Thanks though!
18 replies
FFilament
Created by Christophe on 9/9/2024 in #❓┊help
Custom page messing up sidebar
Fair enough, that works but it's in my deploy script as well (the deploy:build task):
task('deploy', [
'deploy:info',
'deploy:setup',
'deploy:lock',
'deploy:release',
'deploy:update_code',
'deploy:shared',
'deploy:vendors',
'deploy:modules',
'deploy:build',
'deploy:writable',
'artisan:storage:link',
'artisan:migrate',
'artisan:cache:clear',
'artisan:config:cache',
'artisan:queue:restart',
'artisan:view:cache',
'artisan:update-schedule-monitor',
'deploy:symlink',
'deploy:reload',
'deploy:unlock',
'deploy:cleanup',
]);
task('deploy', [
'deploy:info',
'deploy:setup',
'deploy:lock',
'deploy:release',
'deploy:update_code',
'deploy:shared',
'deploy:vendors',
'deploy:modules',
'deploy:build',
'deploy:writable',
'artisan:storage:link',
'artisan:migrate',
'artisan:cache:clear',
'artisan:config:cache',
'artisan:queue:restart',
'artisan:view:cache',
'artisan:update-schedule-monitor',
'deploy:symlink',
'deploy:reload',
'deploy:unlock',
'deploy:cleanup',
]);
18 replies
FFilament
Created by Christophe on 5/17/2024 in #❓┊help
Possibility to hide a table on a list page
Thanks, thats just what I needed. Still starting to get a hang of this...
6 replies