© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
5 replies
Christian Giupponi

import csv and generate slug before save the post

I need to generate a slug while the records are imported.
I tried to use beforeCreate function but can't find any example about how to use it.

I tried:

protected function beforeCreate() : void
    {
        $this->data['slug'] = Str::slug($this->data['name']);
    }
protected function beforeCreate() : void
    {
        $this->data['slug'] = Str::slug($this->data['name']);
    }

but does not seems to work, when import the data I get a sql error because of missing slug.
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Alter CSV data before import
FilamentFFilament / ❓┊help
5mo ago
404 errror and Post request to livewire/update Import csv
FilamentFFilament / ❓┊help
17mo ago
Import XLSX / CSV
FilamentFFilament / ❓┊help
11mo ago
Troubleshooting CSV Import
FilamentFFilament / ❓┊help
2y ago