javif89
javif89
FFilament
Created by javif89 on 12/7/2024 in #❓┊help
Tenant dropdown bug [Alpine issue]
Trying to set up multi tenancy for the first time, and when I click the tenant dropdown I get:
Cannot read properties of undefined reading ('toggle')
Cannot read properties of undefined reading ('toggle')
Looking at the alpine code for the button I see this in the toggle() function:
toggle: function (event) {
$refs.panel.toggle(event)
},
toggle: function (event) {
$refs.panel.toggle(event)
},
I'm assuming $refs.panel is undefined. Not sure what isn't configured correctly. Appreciate any help 🙏
5 replies
FFilament
Created by javif89 on 10/13/2023 in #❓┊help
File upload in actions
Hey guys, I have a question that I couldn't really find an answer for in the docs. I have a model with a form where you can upload an image, all of that works great. Now I'm trying to add a "Bulk upload" action that lets the user upload multiple files and it will create a new record for each file uploaded with some other fields filled out based on the file name. I have the action set up but it's a bit unclear to me how to save the files.
->action(function (array $data) {
$records = [];

foreach ($data['original_file_name'] as $filename => $original) {
$name = Str::from($original)->before('.')->trim()->lower()->replace(' ', '_')->toString();
$records[] = [
'image_path' => $filename,
'category_id' => $data['category_id'],
'name' => $name,
];
}
})
->action(function (array $data) {
$records = [];

foreach ($data['original_file_name'] as $filename => $original) {
$name = Str::from($original)->before('.')->trim()->lower()->replace(' ', '_')->toString();
$records[] = [
'image_path' => $filename,
'category_id' => $data['category_id'],
'name' => $name,
];
}
})
This is what I have so far. I'm just not sure how to save the files from here. Would appreciate any help.
2 replies