Jean-Loup
Jean-Loup
FFilament
Created by Jean-Loup on 4/29/2025 in #❓┊help
Year data type
Hi folks, I'm trying to retrieve data from a table where I set one of the columns to have the mysql data type to be Year(). I know Eloquent can handle this because the migration can use ->year() quite happily and it translates well into the table itself. The data then is just various years. However filament seems to think the data held in there is a Unix timestamp and I can't figure out how to retrieve the data as is and not have it be transformed into a full date some time in the early hours of 1st Jan 1970. It seems like it should be a really straightforward thing to do and yet I can't find anything online about this. On the table in the Resource I tried to force numeric() but that returns a formatted date. Obviously date() also treats it as a time stamp and I can't think of what else to try to simply retrieve the data as it's being stored in the database.
13 replies
FFilament
Created by Jean-Loup on 3/28/2025 in #❓┊help
import from csv into multiple related tables
Hi folks, Sorry for asking but I'm really struggling to find any definitive documentation on how to implement this and I'm not even certain that's even possible at least with the ImportAction from Filament. I have a csv with data we've broken down to be distributed into 6 different tables. I understand the relationship model in the Import action is still in its infancy and only supports belongs_to relationships. However I figured even with that there's no reason I couldn't manage to make my objectives work. So what I'm trying to do is this: - create records for tables if they don't already exist and retrieve the id of the record to be recorded as a foreign key - have the import be one single function, not 6 different import actions. I tried stacking ->importer(MyclassImporter::class) in the Resource I want the imort button to be in but if I do that it ignores every importer except for the last one (yet doesn't return an error) Right now I'm trying to define everything under one MyclassImporter.php file and see if I can make relationships work but I'm not having much luck. I tried using dot notation in ImportColumn::make() but although this doesn't throw an error on screen, it doesn't seem to work either. I was trying to see if perhaps the ->resolveRelatedRecord() method for the ImportColumn class would work but I can find no documentation at all on how to use that. The Filament docs have nothing at all on this method. It seems odd to me that there is so little documentation on how to import into multiple tables. Perhaps my search skills have failed me but I would appreciate any guidance you could provide, even if that's just pointing me towards other ways to do this that don't involve Filament. I hope this all makes sense. Cheers
21 replies