© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•16mo ago•
5 replies
Chaddus Maximus

Filament File Upload Custom Relationship

Hello,

I've been using Filament to build a Dashboard that has a file upload, I've searched through the documentation and github and could not find an answer so I'm hoping I will find one here.

I want to have a file upload that will create a new eloquent model and save it to the database.

I have a JobPosting model that it's name, content, it's tied to the user and it should have mutliple files that are tied to it. So for example a Job Posting of the name 'New Job' can have three images and one PDF document uploaded.

Migration code:
public function up(): void
    {
        Schema::create('job_posting_files', function (Blueprint $table) {
            $table->id();
            $table->string('original_name');
            $table->string('stored_name');
            $table->foreignId('job_posting_id')->nullable()->constrained()->cascadeOnDelete();
            $table->timestamps();
        });
    }
public function up(): void
    {
        Schema::create('job_posting_files', function (Blueprint $table) {
            $table->id();
            $table->string('original_name');
            $table->string('stored_name');
            $table->foreignId('job_posting_id')->nullable()->constrained()->cascadeOnDelete();
            $table->timestamps();
        });
    }


This model is called JobPostingFile and it has it's original name, the stored name which will be hashed and it's tied to a JobPosting.

One Job Posting can have multiple Job Posting Files.

Migration code:
public function up(): void
    {
        Schema::create('job_posting_files', function (Blueprint $table) {
            $table->id();
            $table->string('original_name');
            $table->string('stored_name');
            $table->foreignId('job_posting_id')->nullable()->constrained()->cascadeOnDelete();
            $table->timestamps();
        });
    }
public function up(): void
    {
        Schema::create('job_posting_files', function (Blueprint $table) {
            $table->id();
            $table->string('original_name');
            $table->string('stored_name');
            $table->foreignId('job_posting_id')->nullable()->constrained()->cascadeOnDelete();
            $table->timestamps();
        });
    }


How do I make a form in Filament where I can upload multiple files and for each of those files a new JobPostingFile model will be created, it's original name, stored name will be created and it will be linked to the JobPosting model by it's id?

Help would be really appreciated, I have spent a month and a half and could not find a solution.
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

filament v3: file upload on custom page
FilamentFFilament / ❓┊help
3y ago
Filament file upload issue
FilamentFFilament / ❓┊help
2y ago
Filament Multiple File Upload
FilamentFFilament / ❓┊help
2y ago
Filament: Editing file upload - not previewing
FilamentFFilament / ❓┊help
7mo ago