King Dice
King Dice
Explore posts from servers
FFilament
Created by King Dice on 7/25/2024 in #❓┊help
Select input value not being set
No description
6 replies
FFilament
Created by King Dice on 7/25/2024 in #❓┊help
Select input value not being set
No description
6 replies
FFilament
Created by King Dice on 7/18/2024 in #❓┊help
Only last group is displaying
2 replies
FFilament
Created by King Dice on 7/11/2024 in #❓┊help
Change ToggleButtons Selected Color
That's not what I needed, I want to change the active buttons color from primary to something else
5 replies
FFilament
Created by King Dice on 7/11/2024 in #❓┊help
Filter values keep existing out of nowhere.
I'll delete all storage data and try anyways
7 replies
FFilament
Created by King Dice on 7/11/2024 in #❓┊help
Filter values keep existing out of nowhere.
maybe encrypted cookies or something
7 replies
FFilament
Created by King Dice on 7/11/2024 in #❓┊help
Filter values keep existing out of nowhere.
yes, exactly. I thought of sessions too, but no sessions match their names.
7 replies
FFilament
Created by King Dice on 7/10/2024 in #❓┊help
Brainstorming ways to solve this problem
I mean that's what I do personally when I want to update my CV, I have a resume/ page on my site, I edit it in my code editor and ctrl+P to print to pdf.
14 replies
FFilament
Created by King Dice on 7/10/2024 in #❓┊help
Brainstorming ways to solve this problem
what about just generating the html and instructing the user to "print to PDF" through their own browser, are there any downsides to that?
14 replies
FFilament
Created by King Dice on 7/10/2024 in #❓┊help
Brainstorming ways to solve this problem
thank you for the suggestions
14 replies
FFilament
Created by King Dice on 7/10/2024 in #❓┊help
Brainstorming ways to solve this problem
I think that's the way to go
14 replies
FFilament
Created by King Dice on 7/10/2024 in #❓┊help
Brainstorming ways to solve this problem
hmm, I really need to think this through. it seems like I will end up with some technical debt with whatever option I go with
14 replies
FFilament
Created by King Dice on 7/4/2024 in #❓┊help
ambiguous column name: id
I couldn't figure out how to change the query on the exporter to change the order by clause, so I removed the normal exportAction entirely and kept only the bulkAction which doesn't attempt to sort the results
5 replies
FFilament
Created by King Dice on 6/30/2024 in #❓┊help
Getting weather a field is disabled or not
nevermind, I imported the wrong Component
6 replies
FFilament
Created by King Dice on 6/30/2024 in #❓┊help
Getting weather a field is disabled or not
No description
6 replies
FFilament
Created by King Dice on 6/30/2024 in #❓┊help
Getting weather a field is disabled or not
for context I need this information to conditionally show a hint explaining why a field is disabled
6 replies
FFilament
Created by King Dice on 6/29/2024 in #❓┊help
Best way to handle bulk-attaching models
I figured out a good solution using a custom action, here is the code for future reference:
Action::make('Attach')
->form( [
TagsInput::make('ids')
->label('IDs')
->validationAttribute('IDs')
->required()
->rules([
fn (): Closure => function (string $attribute, $value, Closure $fail) {
$records = User::whereIn('cin', $value)->pluck('cin')->toArray();
$nonExistantIds = array_diff($value, $records);

if(!empty($nonExistantIds)) {
$fail('The following :attribute don\'t exist in the the database: ' . implode(', ',$nonExistantIds));
}
},
])
->splitKeys([' '])
])->action(function (array $data, RelationManager $livewire) {

$ids = User::whereIn('cin', $data['ids'])->pluck('id')->toArray();

$course = Course::find($livewire->ownerRecord->id);

$course->users()->syncWithoutDetaching($ids);

})
Action::make('Attach')
->form( [
TagsInput::make('ids')
->label('IDs')
->validationAttribute('IDs')
->required()
->rules([
fn (): Closure => function (string $attribute, $value, Closure $fail) {
$records = User::whereIn('cin', $value)->pluck('cin')->toArray();
$nonExistantIds = array_diff($value, $records);

if(!empty($nonExistantIds)) {
$fail('The following :attribute don\'t exist in the the database: ' . implode(', ',$nonExistantIds));
}
},
])
->splitKeys([' '])
])->action(function (array $data, RelationManager $livewire) {

$ids = User::whereIn('cin', $data['ids'])->pluck('id')->toArray();

$course = Course::find($livewire->ownerRecord->id);

$course->users()->syncWithoutDetaching($ids);

})
4 replies
FFilament
Created by King Dice on 6/28/2024 in #❓┊help
How to download failed rows?
worth noting that I am using an Admin model that has it's own auth guard and not the traditional User model, maybe filament is hard coded to protect the failed-rows route with the user guard/gate
5 replies
FFilament
Created by King Dice on 6/26/2024 in #❓┊help
Import Model still trying to use user_id despite specifying a different model
thank you, that documentation fixed it
4 replies