© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•14mo ago•
4 replies
steexd

How to safely override Filament core components methods?

Hi everyone!

I’ve made a couple of small modifications directly to Filament’s core BaseFileUpload class (in vendor/filament/filament/src/Forms/Components/BaseFileUpload.php), specifically in two methods,
removeUploadedFile(string $fileKey) and reorderUploadedFiles(array $fileKeys), adding this line: $this->callAfterStateUpdated();

I added this call to callAfterStateUpdated() so that my additional logic inside every FileUpload->afterStateUpdated() can run.

The problem is that these changes will be lost if I update or reinstall my Composer dependencies. So, what’s the recommended way to override or hook into these methods without directly modifying Filament core files?

Thank you in advance!
Solution
Hello
You can Create a new class that extends BaseFileUpload and override the methods up there ...

class CustomFileUpload extends BaseFileUpload
{
    protected function removeUploadedFile(string $fileKey): void
    {
        .....
    }
class CustomFileUpload extends BaseFileUpload
{
    protected function removeUploadedFile(string $fileKey): void
    {
        .....
    }

Then use it
Jump to solution
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

How to override views components in filament
FilamentFFilament / ❓┊help
3y ago
Override classes in filament blade components
FilamentFFilament / ❓┊help
6mo ago
How to override filament default form data store method
FilamentFFilament / ❓┊help
2y ago
Caching Filament components
FilamentFFilament / ❓┊help
2y ago